Я использую следующий крючок Instagram для отправки изображения в Instagram. В iOS 8 приложение Instagram показывалось само по себе в UIDocumentInteractionController, но в iOS 9 оно отображает другие параметры вместе с ним. Кто-нибудь знает, почему это может быть и как разрешить это, чтобы снова показать только Instagram?UIDocumentInteractionController в iOS 9 Не показывать приложение Instagram по умолчанию
UIImage *screenShot = self.shareableImage.image;
NSString *savePath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Test.ig"];
[UIImagePNGRepresentation(screenShot) writeToFile:savePath atomically:YES];
CGRect rect = CGRectMake(0 ,0 , 0, 0);
NSURL *instagramURL = [NSURL URLWithString:@"instagram://media?id=MEDIA_ID"];
NSString *documentDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
// *.igo is exclusive to instagram
NSString *saveImagePath = [documentDirectory stringByAppendingPathComponent:@"Image.igo"];
NSData *imageData = UIImagePNGRepresentation(screenShot);
[imageData writeToFile:saveImagePath atomically:YES];
NSURL *imageURL=[NSURL fileURLWithPath:saveImagePath];
self.dic=[[UIDocumentInteractionController alloc]init];
self.dic.delegate=self;
[email protected]"com.instagram.photo";
[self.dic setURL:imageURL];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
[self.dic presentOpenInMenuFromRect: rect inView: self.view animated: YES ];
}
else
{
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:[NSString stringWithFormat:NSLocalizedString(@"imageShareViewNoInstagramAccountAlertTitle", nil)] message:[NSString stringWithFormat:NSLocalizedString(@"imageShareViewNoInstagramAccountAlertMessage", nil)]delegate:nil cancelButtonTitle:[NSString stringWithFormat:NSLocalizedString(@"imageShareViewNoFacebookAccountAlertCancelButton", nil)]otherButtonTitles:nil, nil];
[alert show];
}
- (UIDocumentInteractionController *) setupControllerWithURL: (NSURL*) fileURL usingDelegate: (id <UIDocumentInteractionControllerDelegate>) interactionDelegate
{
UIDocumentInteractionController *interactionController = [UIDocumentInteractionController interactionControllerWithURL: fileURL];
interactionController.delegate = interactionDelegate;
return interactionController;
}
Im получение той же проблемы. – DevC