2014-07-14 3 views
1

whatsapp를 통해 이미지를 공유하고 싶습니다. 다음 코드로 UIDocumentInteractionController를 사용하고 있습니다. 열린 메뉴 (사용자가 whatsapp를 선택)를 건너 뛰고 첫 번째 옵션을 선택한 것처럼 행동 할 수 있습니까?UIDocumentInteractionController의 presentOpenInMenuFromRect 건너 뛰기

if ([[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:@"whatsapp://app"]]) 
      { 
       NSString *savePath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/whatsAppTmp.wai"]; 
       [UIImageJPEGRepresentation(image, 1.0) writeToFile:savePath atomically:YES]; 

       _documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:savePath]]; 
       _documentInteractionController.UTI = @"net.whatsapp.image"; 
       _documentInteractionController.delegate = self; 

       [_documentInteractionController presentOpenInMenuFromRect:CGRectZero inView:self.view animated: YES]; 


      } 

답변

0

또는 WhatsApp은 ShareKit 확장자 아이폰 OS 8 SDK으로 업데이트되었습니다. 이제 WhatsApp에 대한 공유는 UIActivityController에서 '기본'이며 이미지를 공유하기 위해 UIDocumentInteractionController을 구현할 필요가 없습니다.