Last active
December 13, 2015 22:29
-
-
Save naotokui/4984986 to your computer and use it in GitHub Desktop.
Sending image via Line.app Lineで画像データを送る方法
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSData *data = UIImageJPEGRepresentation([UIImage imageNamed:@"Flower.jpg"] , 0.5); | |
UIPasteboard* pasteboard = [UIPasteboard pasteboardWithName: LINE_PASTEBOARD create: YES]; | |
[pasteboard setData: data forPasteboardType: (NSString *)kUTTypeJPEG]; | |
// LINE | |
NSString *escapedStr = [LINE_PASTEBOARD stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]; | |
NSString *urlStr = [NSString stringWithFormat:@"line://msg/image/%@", escapedStr]; | |
NSURL *sndUrl = [NSURL URLWithString:urlStr]; | |
if ([[UIApplication sharedApplication] canOpenURL:sndUrl]) { | |
[[UIApplication sharedApplication] openURL:sndUrl]; | |
} else { | |
[[[UIAlertView alloc] initWithTitle: @"" message:@"LINE not found." | |
delegate: nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil] show]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment