macOSでカメラを使うアプリを作るとき、'com.apple.security.device.camera' entitlementエラーが出たら
macOSでカメラを使うアプリを作るとき、以下のようなエラーが出ることがある。
2020-08-03 22:26:56.800910+0900 Day9[16262:644033] Metal API Validation Enabled
2020-08-03 22:26:56.904507+0900 Day9[16262:644432] [access] This app has crashed because it has a hardened runtime and attempted to access privacy-sensitive data without an entitlement indicating its intent to access this data. The app must have the 'com.apple.security.device.camera' entitlement.
(lldb)
これは、カメラを使うアプリはセキュリティの制限があり、それをあらかじめ指示しなくてはならないからである。
- Xcodeから、Cmd-1→infor.plist→右クリックしてAdd Row→Keyのところをダブルクリックして「
NSCameraUsageDescription
」と入力。自動的に「Privacy - Camera Usage Desciption」に変わる。 - Valueをダブルクリックして任意のメッセージを入れる。「
カメラからの画像を表示します。
」 - Xcodeから、Cmd-1→MyApp→TARGETS→MyApp→Signing & Capabilities→All→Hardend Runtime→Cameraの左をcheck
- Cmd-Rすると、「“MyApp.app”からカメラにアクセスしようとしています。」と、さきほどのメッセージと共に聞いてくるので「OK」
参考
Author And Source
この問題について(macOSでカメラを使うアプリを作るとき、'com.apple.security.device.camera' entitlementエラーが出たら), 我々は、より多くの情報をここで見つけました https://qiita.com/KoichiroEto/items/a01a0f07ce57e5b53e73著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .