UIApplication.shared.canOpenURL canOpenURL: failed for URL: error 打开文件报错

351 阅读1分钟

iOS 打开文件URL失败报错 canOpenURL: failed for URL: "" - error: "This app is not allowed to query for scheme file"

在iOS 9 以上使用文件URL 必须在info.plist上LSApplicationQueriesSchemes的添加scheme: file

<key>LSApplicationQueriesSchemes</key>
<array>
 <string>file</string>
 <string>whatsapp</string>
 <string>...</string>
</array>