Error "This app does not have access to your photos" - ios

My app is working good on iPhone 5 but has a problem in iPhone 4 with the same iOS 6.0.
The problem is: When I try to open the photo gallery this issue came "This app does not have access to your photos and video"?
How can I solve this in my application programmatically?

There is nothing in the app what you could do.
The first time you attempt to access the library iOS will ask the user whether the App may access the library/photos or not. In your case the user using the iphone 4 tapped on 'no'.
At the same time an entry is created in the settings/privacy/photos/ with the display name of your app and your small settings icon (if you provided one - otherwise the standard icon will be shrinked automatically)
Go there and switch from off to on.
Do not expect this switch to take effect while the app is running. Along with the address book, not the photographed, I even observe some crashes when this setting is changed while the app is running.

Related

App does not appear in iPad Settings list when iPad connected to Mac as external device

I am developing an iPhone/iPad photo processing app on a Mac using Swift in XCode 13.4. When I connect an iPhone running iOS 15.6 as an external device, the app appear in the Settings list and I can allow it to have access to Photos. When I connect to an iPad running iOS 15.5 as an external device the program runs but fails when trying to access photos using info[UIImagePickerController.InfoKey.phAsset.rawValue]. This is commonly because permission to access photos has not been given to the app. When I tried to set this I found that the app did not appear in the Settings list. The app does appear in the iPhone settings list even though it has never been installed from the App Store.
Okay, so it turns out that you mean you're running from Xcode on the device. Good! But that is irrelevant to the question, as it turns out.
The question is why it is that, on the iPad, there is no entry for your app in the Settings app, is that right? So that would be because on the iPad you've never done anything that causes the app to request permission (such as photos).
The point is, you cannot initiate the granting of permissions from Settings; the app itself must first request permission from the user (using the correct PHPhotoLibrary call). Only after that happens will the app acquire a place in Settings where the user can modify the initial permissions.
Adding a programmatic definition of photo access options as suggested by Matt in main form viewWillAppear solved the problem as per https://developer.apple.com/documentation/photokit/delivering_an_enhanced_privacy_experience_in_your_photos_app. However, iOS 14 or newer is required.

standalone iMessage apps behave different in iOS 12

I’m trying to create a standalone iMessage app. I had something that worked in iOS 10. I would be able to send a message and show a view controller when the recepient tapped on the message it would open the view controller for them. This same code behaves very different in iOS 12. When the user taps on the message he gets taken to the app store instead of the view controller.
I’ve been looking everywhere on information about this, but there seems to be nothing on this topic.
Does anybody know what changed or how can I dispay a view controller instead of the app store?
This may seem obvious but I suspect you've missed something in your testing.
The iMessage app will launch if is installed on the receiving phone. The installation test is based on the bundle ID so if you have mismatched that it won't detect your app.
When the app has not been installed, iMessage as of iOS 11 includes a link to take you to the store.
I'm working on a complex iMessage app and along the way created a bunch of small sample apps to test different points. I've just made the repo public if you want to check out some im-plausibilities

App freezes several seconds before start on device

I'm a free developer and I use my swift application on my iPhone 7. I'm using Swift 3 and iOS 10.
So the problem is, sometimes (like 2 of 10 times) when I start the app, iOS freezes like 5 seconds before my app actualy comes to the screen. In this time I only see the app icon is in the highlighted state. This only happens with my own app, not with other apps.
My app also does nothing special on startup and this only happens on the real device, the debugger in Xcode always starts immediately.
So is this a normal behavior? And does it work properly when I decide to put it on the App Store?
Thanks in advance.
I have had this happen to me before. No, this does not happen when it is put out on the App Store. One way to get around this is to use TestFlight. You can upload your archive to apple and select on the 'TestFlight' tab of your app. Click on internal testing and then click on your email and the version of the app you want to test. You should then get an email on your Apple ID telling you to test the app, and it will let you download it. Good question :)
To test the same version which would have been uploaded to the store quickly, change the build configuration to release. To do so, click on your app's name (top left), press edit schema, click the build configuration dropdown, also deselect debug executable. (make sure to turn it back when you're going to debug, or create a new schema with the above settings to let you switch quickly in the future)
You might also try using instruments, that lag on startup might happen if you're trying to load many things in memory on your initial view controller's viewDidLoad or app delegate's didFinishLaunchingWithOptions load, especially when trying to load big files such as images, videos or large plists. You might want to try using instruments (the time profiler instrument specifically) in order to check it out.

Crash when toggling access to Camera and Photos [duplicate]

This question already has answers here:
App crashed in iOS 6 when user changes Contacts access permissions
(2 answers)
Closed 7 years ago.
I have a collection view (standard flow layout) where the first cell is displaying a live camera feed, and the rest of the cells are displaying photos from the user's library using iOS 8's new Photos Framework. Everything renders and works great.
When opening for the first time, I'm prompted for access to the Camera and to the Photos library, as expected. My app behaves fine if I select yes or no for either of the prompts.
However, if I background the app, go into Settings > Privacy > Photos|Camera and toggle access, my app crashes. When connected to Xcode, I don't get any feedback for why the app is crashing.
Unfortunately, Apple's Photos Framework examples app does the same thing.
How can I prevent this from happening? I've subscribed to notifications for AVCaptureDeviceWasConnectedNotification, AVCaptureDeviceWasDisconnectedNotification, and registerChangeObserver on PHPhotoLibrary but those never seem to get called.
Again, here are the steps using Apple's Sample app and the Simulator:
In the Simulator, go to Settings > General > Reset > Reset Location & Privacy
Run the app
Allow the app access to your photos library
Background the Sample App and open Settings
Go to Privacy > Photos and toggle the setting off
Watch Xcode crash
In step 3, if you decline access to your photos, and in step 5, enable access, the app will also crash.
It's not a crash per se. The iOS system terminates every app system wide that has requested access to the Photo Library when that privacy flag is changed (including Apple System Apps).
This originates due to a privacy change made in iOS 6. Look at page 24 in the WWDC 2012 session on Privacy Support in iOS and OS X.

UIApplicationExitsOnSuspend is there an equivalent for iOS 8?

UIApplicationExitsOnSuspend is only applicable to links against SDK 4, is there an equivalent for iOS8?
The app that I am working on has to exit and leave no trace for the user resume from, as the app provides a pay for service, and it requires that the next person using it cannot resume from where the previous user may have left.
I tried things like exit/abort and the latter but all appear to leave a trace to resume from...
In the info.plist for your app click "+" to add a new entry and select "Application does not run in background", for the value select "YES".
When an iOS app moved to the background it takes a snap shot and displays this in the multitasker, you will want to make sure that this doesn't occur when the app is terminated as you may be displaying sensitive information. If this is the case then look in to ignoreSnapshotOnNextApplicationLaunch to prevent that snapshot image from being taken.

Resources