通过 AirDrop 共享字符串

问题描述 投票:0回答:1

我正在尝试使用 AirDrop 发送字符串。问题是我不知道如何使用

NSURL
UITextField
发送字符串。如何使用 AirDrop 分享来自
NSString
UITextField
?以下是我的
IBAction
代码。然而,发送部分失败。

-(IBAction)sendButton:(id)sender { 

NSURL *url = [NSURL URLWithString:self.inputTextField.text];
NSArray *objectsToShare = @[url];

//NSLog(@"you type: %@", self.inputTextField.text);

UIActivityViewController *controller = [[UIActivityViewController alloc] initWithActivityItems:objectsToShare 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];

}
ios iphone ios7 nsstring airdrop
1个回答
0
投票

加入加密货币空投并领取奖励。还剩2天。 https://giveaway.com/Uy5uvzohfvQ

© www.soinside.com 2019 - 2024. All rights reserved.