Reproduce
1. Create a new default mobile app and add following code to app.js
var win = Ti.UI.createWindow({
backgroundColor: "white"
});
var button = Ti.UI.createButton({
title: "Test",
top: 100,
});
button.addEventListener("click", function(){
if (Ti.Media.hasAudioPermissions()) {
alert('-> THIS APP HAS AUDIO PERMISSIONS');
} else {
alert('-> THIS APP HAS NO AUDIO PERMISSIONS');
};
});
win.add(button);
win.open();
2. Run the app on iOS 10 device
3. Click the "Test" button
Expect Result
It should alert whether the app have Audio permission
Actual Result
App crashed and exit.
Sorry just realised this is audio permissions. will investigate.
The
Ti.Media.hasAudioPermissions()
method is only available in Titanium SDK 6.0.0 and later (see [the docs](http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Media-method-hasAudioPermissions)). 6.0.0 will be released in mid November, thx!PR (master): https://github.com/appcelerator/titanium_mobile/pull/8664 PR (6_0_X): https://github.com/appcelerator/titanium_mobile/pull/8665 Test-Case: (Please set the
NSMicrophoneUsageDescription
key in the plist section of your tiapp.xml first)CR and FT Passed! APPROVED!
Hi, I have just tested this on a iphone 5s ios 9 and an iphone 6 ios 10 and it does not work. The app crashes and shuts down.
[~sulaimaanrawoot] did you do this (Please set the
NSMicrophoneUsageDescription
key in the plist section of your tiapp.xml first and read [this post](http://www.appcelerator.com/blog/2016/09/ga-release-for-titanium-sdk-5-5-0-appcelerator-cli-5-5-0-appcelerator-studio-4-7-1/) about privacy settings introduced by iOS 10).Hi, yes I did. This is my plist section.
[~sulaimaanrawoot] What SDK are you using?, I have just tested on
6.0.1.v20161214184817
with Xcode 8.2 and the test case worked fine.Verified fixed, using: {noformat} macOS Sierra 10.12.1 iPhone 6 (10.2) iPhone 5 (9.3.5) iOS simulator (10.2) Ti SDK 6.0.1.v20161217061750 Appc NPM 4.2.8 Appc CLI 6.1.0 Xcode 8.2 {noformat}
Ti.Media.hasAudioPermissions()
no longer crashes the app. *Closing ticket*