Tutorial app gets photos without permission, no SIGABRT

MacOS 10.14.2 (18C54)

Xcode Version 10.1 (10B61)


I'm following the "Start Developing iOS Apps (Swift)" tutorial:

https://developer.apple.com/library/archive/referencelibrary/GettingStarted/DevelopiOSAppsSwift/WorkWithViewControllers.htmlhttps://developer.apple.com/library/archive/referencelibrary/GettingStarted/DevelopiOSAppsSwift/WorkWithViewControllers.html#//apple_ref/doc/uid/TP40015214-CH6-SW1

I got to the point "Checkpoint: Run your app. What happens when you click on the image view?" where it expects a SIGABRT crash due to a missing string that's needed to request permission to access photos.


My app doesn't crash. It shows the photo picker and it displays whatever photo I select. It doesn't have a "Privacy - Photo Library Usage Description" string in Info.plist. It doesn't ask for permission to access photos. When I go to Settings / Privacy / Photos, the FoodTracker app doesn't appear.


This happens in the simulator with iOS 12.1 and on my iPhone 6s (registered to my developer account) with iOS 12.1.2.


Here are the debugger log lines from running in the simulator:

2019-02-04 19:57:43.229284-0800 FoodTracker[1254:26226] libMobileGestalt MobileGestalt.c:890: MGIsDeviceOneOfType is not supported on this platform.

2019-02-04 19:57:45.595264-0800 FoodTracker[1254:26226] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /Users/user/Library/Developer/CoreSimulator/Devices/6802BA11-D1B8-48B6-BCD9-6B258FA9F88A/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles

2019-02-04 19:57:45.595585-0800 FoodTracker[1254:26226] [MC] Reading from private effective user settings.


I clicked "Product / Clean Build Folder" and tried it again. Same result.


Does anybody know why this app seems able to bypass the iOS permissions on photos? Did I accidentally discover a security bug?


Thanks,

Michael

Replies

Screenshots:


Screenshots are not visible to other than yourself here …


You should remove the app from the simulator and reload again by generating again.

And tell what you get then.

Permissions differ on the simulator and on a device and permissions are 'sticky'. If you have given the app permission and then reload and run it again your earlier permission may still apply. So if you really want to test it:

1) use a real device attached to your computer, not the simulator and

2) be sure to delete the old build of the app before reinstalling from Xcode.

Right.


And deleting the old build is also needed and possible on simulator.

Thank you PBK and Claude31 for your replies.


I used the simulator "Hardware / Erase All Content and Settings" option and re-launched the app via Xcode. The app accesses photos without asking for permission.


On my iPhone 6s, I deleted the FoodTracker app. The confirmation dialog said

"""Delete "FoodTracker"? Deleting this app wil also delete its data."""

I pressed the Delete button. Then I re-launched it via Xcode. The app sees my photos without asking for permission. This is a problem for me since I will need to test the my app's permission-requesting code.

Here's a screen recording of the behavior on the simulator:

https://vimeo.com/315795358

It seems that you have not removed the app from the simulator.


hence, existing authorizations may still exist, even if you cleared settings.


So, try remobve the FoodTracker (long press on icon), then rebuild the app.


Thanks to tell if that works now