我想通過我的應用程序將照片張貼到Instagram的。我使用UIDocumentInteractionController根據INstagram guidlines整合iPhone
在我.h文件中UIDocumentInteractionController *documentInteractionController;
在我的.m文件
NSString *fileToOpen = [[NSBundle mainBundle] pathForResource:@"IMG_0192" ofType:@"jpg"];
fileToOpen = [fileToOpen substringToIndex:[fileToOpen length] - 3];
fileToOpen=[NSString stringWithFormat:@"%@ig",fileToOpen];
NSURL *instagramURL = [NSURL URLWithString:@"instagram://app"];
NSLog(@"%@",fileToOpen);
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
//imageToUpload is a file path with .ig file extension
/*UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@""
message:@"Can open app!"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
*/
self.documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:fileToOpen]];
self.documentInteractionController.UTI = @"com.instagram.photo";
self.documentInteractionController.annotation = [NSDictionary dictionaryWithObject:@"Its a testing" forKey:@"InstagramCaption"];
是我缺少something.??it不工作。
哎你這樣做呢?我需要你的幫助 – Hiren 2012-07-09 11:23:36
使用此鏈接http://www.albinopixel.com/blog/posting-to-instagram-from-your-app/ – 2012-12-24 10:35:11