온라인 및 GitHub를 검색하여 이미지 또는 비디오와 같이 IOS에서 PDF를 올바르게 선택할 수있는 방법을 찾지 못했습니다. 예를 들어, 나는 열고이 같은 사진을 (를 hadle 다른 방법으로 사진을 선택)을 선택할 수 있습니다 :이 시도했습니다IOS에서 PDF 파일을 선택하는 방법
self.logoImagePicker = [[UIImagePickerController alloc] init];
self.logoImagePicker.delegate = self;
[self.logoImagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
[self presentViewController:self.logoImagePicker animated:YES completion:nil];
:
// Present PDF;s from which to choose
UIDocumentInteractionController *pdfPicker = [[UIDocumentInteractionController alloc] init];
pdfPicker.delegate = self; // ensure you set the delegate so when a PDF is chosen the right method can be called
[self presentViewController:pdfPicker animated:YES completion:nil];
을하지만 난 여기에 오류가 :
2016-08-10 07:40:59.190 Whats New[55195:1962738] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'No available types for source 0'
*** First throw call stack:
(
0 CoreFoundation 0x00ef1494 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x0060fe02 objc_exception_throw + 50
2 UIKit 0x01eb9dc2 -[UIImagePickerController mediaTypes] + 0
3 Whats New 0x000c6253 -[SellerHomePageViewController choosePdfBtn:] + 243
4 libobjc.A.dylib 0x006240b5 -[NSObject performSelector:withObject:withObject:] + 84
5 UIKit 0x01ab0e38 -[UIApplication sendAction:to:from:forEvent:] + 118
6 UIKit 0x01ab0db7 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 64
7 UIKit 0x01c54f3b -[UIControl sendAction:to:forEvent:] + 79
8 UIKit 0x01c552d4 -[UIControl _sendActionsForEvents:withEvent:] + 433
9 UIKit 0x01c542c1 -[UIControl touchesEnded:withEvent:] + 714
10 UIKit 0x02037d2e _UIGestureRecognizerUpdate + 12763
11 UIKit 0x01b30efd -[UIWindow _sendGesturesForEvent:] + 1559
12 UIKit 0x01b325b6 -[UIWindow sendEvent:] + 1137
13 UIKit 0x01ad3be8 -[UIApplication sendEvent:] + 266
14 UIKit 0x01aa8769 _UIApplicationHandleEventQueue + 7795
15 CoreFoundation 0x00e03e5f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
16 CoreFoundation 0x00df9aeb __CFRunLoopDoSources0 + 523
17 CoreFoundation 0x00df8f08 __CFRunLoopRun + 1032
18 CoreFoundation 0x00df8846 CFRunLoopRunSpecific + 470
19 CoreFoundation 0x00df865b CFRunLoopRunInMode + 123
20 GraphicsServices 0x05aa5664 GSEventRunModal + 192
21 GraphicsServices 0x05aa54a1 GSEventRun + 104
22 UIKit 0x01aaeeb9 UIApplicationMain + 160
23 Whats New 0x000d1e4a main + 138
24 libdyld.dylib 0x03cc4a25 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
: 출력이 오류로
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
사진을 선택하는 것과 비슷하지만 PDF 만 사용할 수 있습니까?
그리고 어디에 있어야합니다. PDF 파일을? 그리고 왜 그것들은'UIImagePickerController'에서 사용할 수 있습니까? – Larme
사과 드리며, 잘못된 것을 붙여 넣으십시오. –
'alloc' /'init'이 아닌'+ interactControllerWithURL :'을 호출해야합니다. – Larme