iOS permission Alerts - removing or suppressing
Based on the comment by Felipe Sabino above I worked out the following. The permissions file of iOS for Xcode 6 is stored at location: ~/Library/Developer/CoreSimulator/Devices/<device>/data/Library/TCC/TCC.db
. So we modify the db file using sqlite3 on the console.
Used the following Perl script from terminal. This could be done in any language really.
$folderLocations = `xcrun simctl list`; // running "xcrun simctl list" on terminal returns iOS device locations
$currentUserID = `id -un`; // get current user
chomp($currentUserID); // remove extra white space from user string
print "currentUserID: $currentUserID"; // debug logs
while($folderLocations =~ /iPad Air \((.{8}-.*?)\)/g) { // Use regex to loop through each iPad Air device found in $folderLocations. Insert the permissions in the database of each.
print "folderLocations <1>: $1\n"; // debug logs
`sqlite3 /Users/$currentUserID/Library/Developer/CoreSimulator/Devices/$1/data/Library/TCC/TCC.db "insert into access values('kTCCServiceAddressBook','com.apple.store.MyApp', 0, 1, 0, 0)"`;
print "\n"; // neat logs
}
This one overrides kTCCServiceAddressBook
permission, but there is also kTCCServiceCalendar
and kTCCServicePhotos
.
Removing iOS permission alert for local notifications when running app in simulator
Unfortunately, I don't think in an automation test there is a good way to do this. I know that even resetting the simulator isn't sometimes enough to reset permissions. I would design your tests to not test a system call, but your own application code.
One way to test different functionality based on whether the user allows notifications is to extract the call to check for permissions and then stub this method out in the testing. This method would be the best practice since the goal is not to test if iOS works but if your application code is correct.
Automated test ABAddressBook and ALAssetsLibrary request access
This answer is working, as Awesome-o said: https://stackoverflow.com/a/28473742/1979235 (with some modifications, which I will comment on there)
Related Topics
Set<Nsobject>' Does Not Have a Member Named 'Anyobject." - Xcode 6.3
The Bundle's Info.Plist Does Not Contain a Cfbundleversion Key or Its Value Is Not a String
Optional Binding Succeeds If It Shouldn'T
Enable Uialertaction of Uialertcontroller Only After Input Is Validated
How to Remove All References for Outlet
Gamecenter iOS 9 Gamecenter Gklocalplayerlistener Methods Not Called
Xcode 7 Crash: [Nslocalizablestring Length] 30000
How to Convert Video (In Gallery) to Nsdata? in Swift
How to Run Multiple iOS Simulators at Once
How to Programmatically Get iOS's Alphanumeric Version String
Swift Put Multiple Iboutlets in an Array
iOS Color to Transparent in Uiimage
Share Datas Between Two Apps with iOS 8 App Groups (Using Nsuserdefaults)
Is Wkwebview Designed as a Replacement of Uiwebview
Warning in Custom Map Annotations Iphone
How to Make Alamofire Download Progress Run in Background iOS