Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

ios - The app's Info.plist must contain an NSMicrophoneUsageDescription key with a string value explaining to the user how the app uses this data

Got a build rejection The app's Info.plist must contain an NSMicrophoneUsageDescription key with a string value explaining to the user how the app uses this data.

The app does not use microphone. Or so I think.

How do I track down where mic is used?

UPD23112016: given that the lazy answer is being upvoted I've filed a new feature request with apple to close this security hole.

UPD05042017: it is still bothersome that once you proxy mic access into some 3rd party framework via some half baked NSMicrophoneUsageDescription you have zero control on where and when it can be used if user agrees to allow mic access. Folks, please do due diligence and craft precise NSMicrophoneUsageDescription that reflects on the fact that the mic is used by the code that's completely outside of your control when the usage is obscured by a 3rd party binary-only framework. Thanks.

UPD2021: Apple did what they could with audit trail for shared resource (such as mic) usage in the latest iOS so the users have some recourse checking when actual access has happened. Nice try, but how many are gonna do the due diligence though?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

For the lazy:

if you want to quickly add usageDescriptions for most media access (on-device photos, camera, video recording, location):

right click your info.plist file and -> open as -> Source Code

then paste the following between the current values:

<key>NSMicrophoneUsageDescription</key>
<string>Need microphone access for uploading videos</string>
<key>NSCameraUsageDescription</key>
<string>Need camera access for uploading images</string>
<key>NSLocationUsageDescription</key>
<string>Need location access for updating nearby friends</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>This app will use your location to show cool stuffs near you.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Need photo library access for uploading images</string>

These descriptions, of course, are up to you. I tried to make them as generic as possible.

Hope this saves someone's time!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...