Created
September 21, 2017 10:42
-
-
Save KAMEDAkyosuke/a447d30f44d8150c747f7f666078551b to your computer and use it in GitHub Desktop.
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
NSMutableArray<id> *items = [NSMutableArray array]; | |
NSURL *url = [NSURL URLWithString:@"https://www.google.co.jp"]; | |
NSString *text = @"hello world"; | |
[items addObject:url]; | |
[items addObject:text]; | |
UIActivityViewController *activityViewController = [[UIActivityViewController alloc] initWithActivityItems:items | |
applicationActivities:nil]; | |
// select copy action | |
[self presentViewController:activityViewController | |
animated:YES | |
completion:^{ | |
// then check pasteboard | |
NSArray<NSString*> *strings = [[UIPasteboard generalPasteboard] strings]; | |
NSLog(@"%@", strings); /* | |
* ( | |
* "https://www.google.co.jp\nhello world", | |
* "https://www.google.co.jp" | |
* ) | |
* WTF!? | |
*/ | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment