2012-09-27 71 views
11

的作品我有與iOS5的,現在在iOS6的內置Instagram的分享,分享不再起作用雖然canOpenURL返回true,代碼執行的應用程序。圖像以.igo的擴展名保存到應用程序的文檔文件夾中。這通過com.instagram.exclusivegram傳遞給instagram。UIDocumentInteractionController不再iOS6的

的代碼如下,它進入if語句,並顯示「在這裏」,但沒有打開分享對話框喜歡它在屏幕的底部使用。

 NSLog(@"%@", _imgToUpload); 
     NSURL *instagramURL = [NSURL URLWithString:@"instagram://app"]; 
     if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) { 
      uidController = [[UIDocumentInteractionController alloc] init]; 
      //imageToUpload is a file path with .igo file extension 
      uidController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:_imgToUpload]]; 
      uidController.UTI = @"com.instagram.exclusivegram"; 
      uidController.delegate = self; 
      CGRect navRect = self.view.frame; 
      [uidController presentOpenInMenuFromRect:navRect inView:[UIApplication sharedApplication].keyWindow animated:YES]; 
      NSLog(@"here in"); 
     } 

_imgToUpload也提供了正確的文件路徑。

謝謝 尼克

回答

11

只是做了一些測試,並找到了解決辦法。不要出現在keyWindow中。

[uidController presentOpenInMenuFromRect:navRect inView:self.view animated:YES]; 

我測試過了,它會解決這個問題。

+0

謝謝,我已經想通了,忘了發佈!良好的結果 –

+0

感謝這個作品。但是沒有任何方法可以直接進入Instagram,沒有「Open In」操作表? – GeneCode

0

另一個原因uidocumentinteraction控制器iOS6的不工作是,新的動作片/發射面板(它顯示了可用來打開該文檔的應用程序)現在使用。我的應用程序工作正常啓動與iOS5的iBooks失敗,因爲我從viewDidLoad啓動,這是現在太早,我得到當前視圖控制器'其視圖不在窗口層次結構'的錯誤,所以我改變了我的代碼執行選擇器後延遲1秒。該應用程序現在通過新面板調用iBooks。

相關問題