配置Document Types
- 选择项目的target -> info -> Document Types
- 在下面的地址找到要接收文件的UTI
https://developer.apple.com/library/archive/documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html#//apple_ref/doc/uid/TP40009259 - 填写UTI,Types要写查到的UTI,其他随意
处理接收到的文件
现在,从airdrop接收到对应UTI的文件后,打开App的列表里就有我们的App了,这时选择我们的App打开,文件会被拷贝到App沙盒里的Documents/Inbox/
目录下。
在AppDelegate
的 applicationDidBecomeActive:
方法里处理接收到的文件就好了。
同时也要在 application:openURL:options: