restrict airdrop feature for specific app only ios7

本秂侑毒 提交于 2019-12-25 02:26:51

问题


I am creating one application using airdrop feature, I want to pass one message(NSString) from one device to other device. I had completed that part, but I want restrict this feature for my application only. Currently what happen, when I am sending NSString via airdrop (let say Device A) in near by device, the other Device B can receive this string even if my application is not installed in it.

My requirement is to share one message from one device to other device only and this thing happen via airdrop for my application only. Please give suggestion. Thanks..!!


回答1:


To ensure that only your app can open this "payload" you must register a new UTI with the system, and supply that same UTI when providing the item to share to UIActivityViewcontroller (using the UIActivityItemSource protocol). The AirDrop sample code has an example of registering a new UTI and using it (see the "Sending/receiving an instance of a custom class as data via AirDrop" parts of the sample)



来源:https://stackoverflow.com/questions/20799123/restrict-airdrop-feature-for-specific-app-only-ios7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!