You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MAUI MacCatalyst沙箱应用无法获取蓝牙与本地存储权限

.NET MAUI MacCatalyst启用App Sandbox后权限请求失效问题

启用App Sandbox后,MacCatalyst应用无法获取任何权限(尤其是蓝牙和本地数据权限),尽管已在Info.plist和Entitlements.plist中配置好所有权限,但权限请求弹窗完全不显示。

注:禁用沙箱后一切正常,但为了使用安全存储必须启用沙箱。

Entitlements.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.network.client</key>
    <true/>
    <key>com.apple.security.bluetooth</key>
    <true/>
    <key>com.apple.security.files.user-selected.read-write</key>
    <true/>
    <key>com.apple.security.files.bookmarks.app-scope</key>
    <true/>
    <key>keychain-access-groups</key>
    <array>
        <string>$(AppIdentifierPrefix)com.mycompany.myapp</string>
    </array>
</dict>
</plist>

Info.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>UIDeviceFamily</key>
    <array>
        <integer>2</integer>
    </array>
    <key>UIRequiredDeviceCapabilities</key>
    <array>
        <string>bluetooth-le</string>
    </array>
    <key>XSAppIconAssets</key>
    <string>Assets.xcassets/ic_launcher.appiconset</string>
    <key>CFBundleName</key>
    <string>my App Name</string>
    <key>CFBundleDevelopmentRegion</key>
    <string>en</string>
    <key>UIBackgroundModes</key>
    <array>
        <string>location</string>
        <string>bluetooth-central</string>
        <string>remote-notification</string>
    </array>
    <key>UIFileSharingEnabled</key>
    <true/>
    <key>LSSupportsOpeningDocumentsInPlace</key>
    <false/>
    <key>NSBluetoothAlwaysUsageDescription</key>
    <string>My app requires Bluetooth Permissions .</string>
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>If enabled, my App uses location services to store the geo-coordinates of the logger at the time of configuration.</string>
    <key>UIViewControllerBasedStatusBarAppearance</key>
    <false/>
    <key>ITSAppUsesNonExemptEncryption</key>
    <true/>
    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLName</key>
            <string>my app</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>url</string>
            </array>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
        </dict>
    </array>
    <key>CFBundleIdentifier</key>
    <string>com.mycompany.myapp</string>
    <key>NSDocumentsFolderUsageDescription</key>
    <string>My app  requires access to the Documents folder </string>
</dict>
</plist>

环境版本

  • .NET MAUI版本:9.0.10
  • .NET版本:9

内容的提问来源于stack exchange,提问作者Swetha

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.14 18:44:50