AirDrop iOS 7 new feature

4.6k views Asked by At

I am trying to implement AirDrop feature in my iOS Application. However, I am unable to find any specific tutorial or resources regarding this feature. Can someone please provide me with a sample, or a link, regarding the implementation of the AirDrop feature in iOS 7?

Any help is highly appreciated, thanks.

3

There are 3 answers

0
Karim On BEST ANSWER

Airdrop is a feature that was added to the currently available UIActivityViewController. If a user has iOS7 on a supported device (iPad mini, iPad 4, iPhone 5, iPhone 5c, iPhone 5s), then airdrop should be available to them as just another option, unless you explicitly exclude that activity.

3
Nabeel Thobani On

Try this, its built in feature. Do this in your button selector.

UIDocumentInteractionController *interaction = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:fileToTransferPath]];
//fileToTransferPath can be the path of a file supported by airdrop feature.
interaction.delegate = self;
[interaction presentOpenInMenuFromRect:sender.frame inView:self.view animated:NO];

Don't forget to add UIDocumentInteractionControllerDelegate in .h file.

1
lehn0058 On

Lets say you want to share a URL with someone. You can do it like this using the UIActivityViewController:

// Build a collection of activity items to share, in this case a url
NSArray *activityItems = @[[NSURL URLWithString:link]];

// Build a collection of custom activities (if you have any)
NSMutableArray *customActivities = [[NSMutableArray alloc] init];


UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:customActivities];

[self presentViewController:activityController animated:YES completion:nil];

This would also give you access to other social sharing functions automatically, unless you disable them through the customActivities collection.

https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIActivityViewController_Class/Reference/Reference.html