Lineに画像を投稿する
Lineに画像を投稿するサンプルを作りましたので載せておきます。
+ (void)postImageToLine:(UIImage *)imageName { UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; [pasteboard setData:UIImageJPEGRepresentation(imageName, 1) forPasteboardType:@"public.jpeg"]; NSString *LineUrlString = [NSString stringWithFormat:@"line://msg/image/%@", pasteboard.name]; //LINEがインストールされているか確認。されていなければアラート→AppStoreを開く if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:LineUrlString]]) { [[UIApplication sharedApplication] openURL:[NSURL URLWithString:LineUrlString]]; } else { [self lineOpenAlert:@"LINEがインストールされていません" message:@"AppStoreを開いてLINEをインストールします。"]; }} +(void)lineOpenAlert:(NSString *)title message:(NSString *)message{ UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title message:message delegate: self cancelButtonTitle:@"いいえ" otherButtonTitles:@"はい", nil ]; [alert show]; } + (void)lineAlertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { switch (buttonIndex) { case 0://いいえのとき break; case 1://はいのとき [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://itunes.apple.com/jp/app/line/id443904275?mt=8"]]; break; } }