iOS5 用に構築された instagram と共有するアプリがあり、現在は iOS6 で、共有は機能しませんが、canOpenURL
true を返し、コードが実行されます。画像はアプリケーションのドキュメントフォルダに.igo
拡張子を付けて保存されます。これは com.instagram.exclusivegram で instagram に渡されます。
コードは以下のとおりです。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
正しいファイルパスも提供しています。
ありがとう、ニック