我有一个测试PDF文件,我想通过我的应用程序在iBook中打开。我在临时目录中保存它,我使用此代码加载到的iBooks:UIDocumentInteractionController在iBooks中打开pdf崩溃
NSURL *targetURL = [NSURL fileURLWithPath:tempFullPath];
NSLog(@"Path is %@", tempFullPath);
UIDocumentInteractionController *controller = [UIDocumentInteractionController interactionControllerWithURL:targetURL];
controller.delegate = self;
controller.UTI = @"com.adobe.pdf";
[controller presentOpenInMenuFromRect:self.view.bounds inView:self.view animated:YES];
上弹出菜单就好了,但是当我点击该按钮的iBooks应用程序崩溃和挂起我的Xcode。
到文件我在NSLog的输出得到的路径是这样的:
Path is /private/var/mobile/Applications/65EC4182-A79B-431C-9E74-BD72D91A31AB/tmp/TestFile.pdf
我在做什么错?提前致谢!
控制台中显示的错误是什么?什么是堆栈跟踪?你的应用崩溃在哪里? – rmaddy 2013-03-27 16:27:10
@rmaddy应用程序在我点击UIDocumentInteractionController中的iBooks图标后崩溃,我只在Xcode中获得线程1:EXC_BAD_ACCESS(code = 1,address = blah blah)消息。 – 2013-03-27 16:28:30
启用僵尸并查看消息是否被发送到释放对象。最有可能的问题是,你不保留对'UIDocumentInteractionController'的引用,因此它被过早释放。 – rmaddy 2013-03-27 16:31:08