Ich habe den folgenden Code ein URL
durch AirDrop
senden:Anpassen der Abwurf Alarm Beschreibung in IOS
NSString* selfUrlScheme = [[[[[[NSBundle mainBundle]
infoDictionary]
valueForKey:@"CFBundleURLTypes"]
objectAtIndex:0]
valueForKey:@"CFBundleURLSchemes"]
objectAtIndex:0];
NSURL* schemeURL = [NSURL URLWithString:
[NSString stringWithFormat:
@"addList:%@,%@",
self.list.uniqueID,
selfUrlScheme]];
NSArray *objectsToShare = @[schemeURL];
controller = [[UIActivityViewController alloc]
initWithActivityItems:objectsToShare
applicationActivities:nil];
// Exclude all activities except AirDrop
NSArray *excludedActivities = @[UIActivityTypePostToTwitter,
UIActivityTypePostToWeibo,
UIActivityTypeAssignToContact,
UIActivityTypeSaveToCameraRoll,
UIActivityTypeAddToReadingList,
UIActivityTypePostToFlickr,
UIActivityTypePostToVimeo,
UIActivityTypePostToTencentWeibo];
controller.excludedActivityTypes = excludedActivities;
[self presentViewController:controller animated:YES completion:nil];
Der Empfänger erhält dann die folgende Meldung:
Ist es möglich, Ändern Sie den Text der URL
gefunden nach "X möchte teilen" zu etwas benutzerfreundlicher wie "X möchte eine Liste mit Ihnen teilen"? Danke im Voraus!
EDIT
Ich habe das jetzt, aber es noch erzeugt das gleiche Ergebnis oben:
AirDropCustomURL *container = [[AirDropCustomURL alloc] initWithUrl:schemeURL];
NSString *message = @"a list";
controller = [[UIActivityViewController alloc] initWithActivityItems:@[message, container] applicationActivities:nil];
@interface AirDropCustomURL : NSObject <UIActivityItemSource>
@property (strong, nonatomic) NSURL *url;
@property (strong, nonatomic) UIImage *productImage;
- (id)initWithUrl:(NSURL *)url;
@implementation AirDropCustomURL
- (id)initWithUrl:(NSURL *)url {
if (self = [super init]) {
_url = url;
}
return self;
}
#pragma mark - UIActivityItemSource
- (id)activityViewControllerPlaceholderItem:(UIActivityViewController *)activityViewController {
//Because the URL is already set it can be the placeholder. The API will use this to determine that an object of class type NSURL will be sent.
return self.url;
}
- (id)activityViewController:(UIActivityViewController *)activityViewController itemForActivityType:(NSString *)activityType {
//Return the URL being used. This URL has a custom scheme (see ReadMe.txt and Info.plist for more information about registering a custom URL scheme).
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1) {
return nil;
} else {
if ([activityType isEqualToString:UIActivityTypeAirDrop]) {
return self.url;
}
}
return nil;
}
Ich schätze, du hast kein Glück für diesen ... sehe meine bearbeitete Antwort. –