我有一個測試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