有没有人知道如何在我的应用程序上接收通过 AirDrop 发送的 NSString?到目前为止,我的应用程序可以通过 AirDrop 发送 NSString。但我不知道如何使用我的应用程序打开通过 Airdrop 发送的 NSString。
@interface ComposeViewController ()
@end
@implementation ComposeViewController
- (void)viewDidLoad
{
[super viewDidLoad];
}
-(BOOL) textFieldShouldReturn: (UITextField *) textField
{
[textField resignFirstResponder];
return YES;
}
- (IBAction)sendButton:(id)sender {
NSString* message= self.inputTextField.text;
NSLog(@"you type: %@", self.inputTextField.text);
// enabling airdrop
UIActivityViewController *controller = [[UIActivityViewController alloc] initWithActivityItems:@[message] applicationActivities:nil];
// Exclude all activities except AirDrop.
NSArray *excludedActivities = @[UIActivityTypePostToTwitter, UIActivityTypePostToFacebook,
UIActivityTypePostToWeibo,
UIActivityTypeMessage, UIActivityTypeMail,
UIActivityTypePrint, UIActivityTypeCopyToPasteboard,
UIActivityTypeAssignToContact, UIActivityTypeSaveToCameraRoll,
UIActivityTypeAddToReadingList, UIActivityTypePostToFlickr,
UIActivityTypePostToVimeo, UIActivityTypePostToTencentWeibo];
controller.excludedActivityTypes = excludedActivities;
// Present the controller
[self presentViewController:controller animated:YES completion:nil];
//[self.readTextView setText:self.inputTextField.text];
}