2
- (IBAction)postToInstagram:(id)sender {
NSURL *instagramURL = [NSURL URLWithString:@"instagram://app"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL])
{
CGRect rect = CGRectMake(0,0,0,0);
NSString *jpgPath=[NSHomeDirectory() stringByAppendingPathComponent:@"Documents/Home_1_instgram.igo"];
UIImage *imageN = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@", jpgPath]];
// [UIImagePNGRepresentation(_imageDetail.image) writeToFile:jpgPath atomically:YES];
NSURL *igImageHookFile = [[NSURL alloc] initWithString:[[NSString alloc] initWithFormat:@"file://%@",jpgPath]];
self.documentController.UTI = @"com.instagram.exclusivegram";
self.documentController = [self setupControllerWithURL:igImageHookFile usingDelegate:self];
NSString *caption = self.catalogueImage.caption; //settext as Default Caption
//Removing pre-filled captions from mobile sharing
//http://developers.instagram.com/post/125972775561/removing-pre-filled-captions-from-mobile-sharing
self.documentController.annotation = [NSDictionary dictionaryWithObject:@"Here Give what you want to share" forKey:@"InstagramCaption"];
NSLog(@"caption: %@",caption);
[self.documentController presentOpenInMenuFromRect: rect inView: self.view animated: YES ];
}
else
{
UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"INSTAGRAM NOT FOUND" message:@"Please install instagram to post to instagram." delegate:nil cancelButtonTitle:nil otherButtonTitles:@"ok", nil];
[alert show];
}
}
我仍然遇到同樣的問題Mohamad Frahand我仍然看到instagram的過濾器部分而不是修剪部分 –
但我已經在我的代碼中嘗試了您的操作,然後將它發送到此處! 你可以上傳你的代碼嗎? – Mohamad
我正在使用NSURL而不是schemeAvailable,其他所有內容都是相同的NSURL * instagramURL = [NSURL URLWithString:@「instagram:// app」]; 如果([[UIApplication的sharedApplication] canOpenURL:instagramURL]){ 我 –