4

コマンドを使用してOSXアプリをサンドボックス化しようとしていますcodesign(これは一般的なlispアプリであり、Xcodeを使用しません)。私は次のような非常に基本的なenitlementsplistを作成しました。

<?xml version="1.0" encoding="utf-8"?>
<plist version="1.0">
    <dict>
        <key>com.apple.security.app-sandbox</key>
        <true/>
    </dict>
</plist>

そして私はcodesignコマンドを呼び出しています:

codesign -s - -f --entitlements "/path/to/my/app/MyApp.app/Contents/entitlements.plist" "/path/to/my/app/MyApp.app/"

ただし、このコマンドは次のエラーを返します。

/path/to/my/app/MyApp.app/Contents/entitlements.plist: cannot read entitlement data

このエラーは、間違ったコマンドを使用したことを意味しますか?もしそうなら、コマンドの何が問題になっていますか?

4

2 に答える 2

1

Xcodeで生成されたplistはバイナリ形式であり、かなり標準的な制限付きサンドボックス設定では次のようになります。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.developer.ubiquity-container-identifiers</key>
    <array>
        <string>$(TeamIdentifierPrefix)com.company.appanme</string>
    </array>
    <key>com.apple.developer.ubiquity-kvstore-identifier</key>
    <string>$(TeamIdentifierPrefix)com.company.appname</string>
    <key>com.apple.security.app-sandbox</key>
    <true/>
    <key>com.apple.security.assets.movies.read-only</key>
    <true/>
    <key>com.apple.security.assets.music.read-only</key>
    <true/>
    <key>com.apple.security.assets.pictures.read-only</key>
    <true/>
    <key>com.apple.security.files.user-selected.read-write</key>
    <true/>
    <key>com.apple.security.network.client</key>
    <true/>
    <key>com.apple.security.print</key>
    <true/>
    <key>com.apple.security.files.bookmarks.document-scope</key>
    <true/>
</dict>
</plist>

私が提案できるのは、Xcodeを使用してplistを作成し、手動で不要なキーを削除することだけです。あなたの場合...

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.security.app-sandbox</key>
    <true/>
    <key>com.apple.security.files.user-selected.read-write</key>
    <true/>
    <key>com.apple.security.network.client</key>
    <true/>
</dict>
</plist>

!DOCTYPE署名ツールで何らかの理由で要素が必要であり、encoding属性が大文字である必要があるかどうか疑問に思っています。

com.apple.security.files.user-selected.read-writeまた、基本的なlispアプリ、特にプロセスファイルへのアクセスを許可するキーと言っても必要になる可能性のあるいくつかのキーを残しました。

于 2013-03-10T20:01:57.393 に答える
1

グーグル検索からこれを見つける人々のために:

ほぼ同じエラーが発生しました:

~/Desktop/Instagram.xcent: cannot read entitlement data

解決策は~、パスで使用せず、代わりに使用することでした/Users/...

于 2020-10-30T18:52:00.353 に答える