My next problem is the following: I have an app that shares via AirDrop a custom URL scheme:
NSMutableString *mutableString = [NSMutableString stringWithString:@"appName://"];
[mutableString appendString:contentProduct.url];
NSURL *airDropUrl = [[NSURL alloc] initWithString:mutableString];
LAAirDropCustomUrl *customUrlSCHEMA = [[LAAirDropCustomUrl alloc] initWithUrl:airDropUrl];
NSArray *activityItems = [NSArray arrayWithObjects:customUrlSCHEMA, nil];
UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:activityItems
applicationActivities:nil];
I've added the URL scheme in the Info section of the project's target, and sharing via AirDrop works just fine. On the other hand, if the other device does not have the app, a default alert is shown, stating that "the device x is trying to share smth on an app that you don't have, wanna go get from appstore?". I would like that, if the other device does NOT have the app, to send a different URL that a browser could open.
If I'm trying to add default NSURL* among the activityItems, I'm getting a error saying that "the device x cannot receive these kind of items"
NSURL *airDropUrl = [[NSURL alloc] initWithString:mutableString];
NSArray *activityItems = [NSArray arrayWithObjects:airDropUrl,customUrlSCHEMA , nil];
The LAAirDropCustomUrl implementation is:
- (id)initWithUrl:(NSURL *)url {
if (self = [super init]) {
_url = url;
}
return self;
}
- (id)activityViewControllerPlaceholderItem:(UIActivityViewController *)activityViewController {
return self.url;
}
- (id)activityViewController:(UIActivityViewController *)activityViewController itemForActivityType:(NSString *)activityType {
if ([activityType isEqualToString:UIActivityTypeAirDrop]) {
return self.url;
}
return nil;
}