다른 앱의 웹에서 파일을 열려고합니다.UIDocumentInteractionController 및 웹의 파일
내 코드 :
NSURLRequest *req = [[NSURLRequest alloc] initWithURL:url];
[NSURLConnection sendAsynchronousRequest:req queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *resp, NSData *respData, NSError *error){
NSLog(@"resp data length: %i", respData.length);
NSArray *names = [objDict[@"name"] componentsSeparatedByString:@"."];
NSString *fileName = [@"downloaded." stringByAppendingString:names[names.count-1]];
NSString * path = [NSTemporaryDirectory() stringByAppendingPathComponent:fileName];
NSError *errorC = nil;
BOOL success = [respData writeToFile:path
options:NSDataWritingFileProtectionComplete
error:&errorC];
if (success) {
UIDocumentInteractionController *documentController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:path]];
documentController.delegate = self;
[documentController presentOptionsMenuFromRect:CGRectZero inView:self.view animated:YES];
} else {
NSLog(@"fail: %@", errorC.description);
}
}];
그것은 패널을 보여 주지만, 어떤 버튼의 클릭에 충돌 ('취소'뿐만 아니라).
내가 좀비 오브젝트를 활성화하고 기록 :-[UIDocumentInteractionController URL]: message sent to deallocated instance