0
私はWhatsApp
を含む他のアプリと共有イメージを開発しています。 私はこのコードを使用しています。自動オープンWhatsAppは他のアプリを提示せずに直接UIDocumentINteractionControllerを使用します
if ([[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:@"whatsapp://app"]]){
UIImage *image = [self processImage:sender];
NSString *savePath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/whatsAppTmp.wai"];
[UIImageJPEGRepresentation(image, 1.0) writeToFile:savePath atomically:YES];
_documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:savePath]];
_documentInteractionController.delegate = self;
_documentInteractionController.UTI = @"net.whatsapp.image";
[_documentInteractionController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];
}else {
[self showAlertTitle:@"WhatsApp not installed." message:@"Your device has no WhatsApp installed."];
}
問題は、私はこのコードを実行すると、documentInteractionController
このimageのような他のオプションのアプリを提供し、私はそれオープンのWhatsAppのアプリケーションの前に最初のWhatsAppを選択しなければならない、です。
メニューを表示せずにファイルを共有するにはWhatsapp Appを選択できますか?つまり、presentOpenInMenuFromRect
を避けることはできますか?私のInstagramのでもiOSの9を使用して、この問題が起こる
I`mはい
私はテキストデータではなく画像データを送信する必要があるので、この方法は使用できません。私が知っているように、カスタムURLスキームはまだ画像データをサポートしていません。 –
@calvinsugianto編集を参照してください。 –
コード内に共有拡張メソッドを実装する方法は?私はShareExtensionがdocumentInteractionControllerメソッドを参照すると思います。 –