问题
My app using Audiokit is running perfectly without sandbox. But as soon as I enable sandbox in Xcode the app crashes when trying to initialize the mic access. (The app is on the App Store for iOS, but now I am trying to submit to the Mac Store as a OS X app but I need to enable sandbox)
Has anyone been able to submit a Mac app to the Mac App Store with Audiokit in it?
ERROR: >avae> AVAudioEngine.mm:275: AttachNode: required condition is false:
node != nil
回答1:
To enable microphone access in App Store sandbox you'll need to add following entitlement:
com.apple.security.device.audio-input
See reference of Sandbox: Enabling Hardware Access
回答2:
This entitlements file did work for me. But it doesn't cover all the cases. Please check Apple documentation for more details https://developer.apple.com/library/archive/technotes/tn2312/_index.html
<?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.device.audio-input</key>
<true/>
<key>com.apple.security.device.audio-video-bridging</key>
<true/>
<key>com.apple.security.files.bookmarks.document-scope</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.temporary-exception.audio-unit-host</key>
<true/>
<key>com.apple.security.temporary-exception.mach-lookup.global-name</key>
<array>
<string>com.apple.midiserver</string>
<string>com.apple.midiserver.io</string>
</array>
</dict>
来源:https://stackoverflow.com/questions/49115091/audiokit-crashes-when-enabling-sandbox-in-os-x