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

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.

Related

How can i export app file in Xcode

Do you know how to export app file in Xcode?
(like .apk file in android)
I want to send my testing app to someone for feedback.
i have never tried it before. please let me know easy way to export app file.
(not all project, only a file which can be played in another iPhone)
First Archive it (XCode->Product->Archive).
(For Archive button to be in visible state : either your device should be selected or generic ios device should be selected, incase any simulator is selected archive button will be disabled.)
A Window will appear :
Choose Export->AdHoc.
.ipa will be generated.
u can use https://www.diawi.com/ for uploading and send app to anyone.
I am posting a very late response to this old question in case anyone else finds their way here and infers that it isn't possible to export an app to your own iPhone or iPad without a developer account. That isn't true. I unearthed these posts when looking for an answer to the same question, and initially read them that way.
If you want to test an app you have written in XCode on your own iOS device you do not need a developer account. Provided the device you wish to test it on (or share it with) is physically nearby so that you can connect it to your macOS device to pair with it as a trusted device, it will remain paired when physically disconnected and accessible over a shared network by WiFi. You can build and run apps from XCode on to the iOS destination device and they will remain in place there and executable afterwards. There is a limit to how many exported apps there can be at one time, which seems to be 3.
Apple explain how to do all this here. You do need to have a registered App Store account, but that's the same one you use to buy apps and build projects in XCode, and it's free unless you want to distribute your app through the App Store.

App crash on iPhone 7 but not on simulator

My Objective-c app is working well so far from iPhone 5 to iPhone 6s plus. But 2 days before I got some complaints from some iPhone 7 users, the app is crashing on their phone as soon as they installed the app. And when they tap the app icon also the app is crashing. But when I run it on iPhone 7 simulator I don't get any issue. I don't even have an iPhone 7 device to check this issue. Is there any way that I can catch this issue even using an online tool? Please suggest me a solution. Thanks.
Here’s what you’ll need to do to stop the apps from crashing or hanging immediately on open: Install any waiting software update, found in Settings > General > Software Update (it is likely versioned as 10.0.1 and the iPhone 7 may ship with iOS 10.0)
Install and let the iPhone reboot as usual
Open the App Store
Download any new app at all, literally any app, whether it is free or paid does not matter
You’ll see a pop-up message saying Terms and Conditions have changed, accept the new terms by tapping on the numerous “Agree” screens
Exit the App Store
Return to the Home Screen and launch the app(s) that were crashing initially
Source : http://osxdaily.com/2016/09/16/fix-apps-crashing-immediately-new-iphone/
I had the same issue with my old app, then added the permission in Info.plist. like
For Camera:
<key>NSCameraUsageDescription</key>
<string>You can take photos to document your job.</string>
Photo Library
<key>NSPhotoLibraryUsageDescription</key>
<string>You can select photos to attach to reports.</string>
Please check you app for other permission like microphone or other. I hope this will fix your problem.
If you are not satisfied from above answer then try Instuments to check any memory issue or other issue with iPhone 7

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.

Can an iOS app determine the other apps that are on the iphone and what permissions they have?

I'm wondering if an app has access to the info that shows the other apps on the phone and what permissions they have (i.e. access to your location, contacts, etc).
Could I create an iOS app with a feature that displays other apps and their permissions? I know the user can view this info via settings, but I'm wondering if it can be organized and displayed by an app.
a similar question was asked here:
How an app to know what other apps have been installed in the device
but the solution method (iHasApp) only works for about 50% of apps, and doesn't address seeing the permissions of those apps.
Thanks!
No you can't access apps data due to sandbox structure upto iOs7.

Lock iOS app in single app mode programmatically

Note : I don't want to submit this app to app store.
What i want to achieve :
I want simple app with one view having two button Lock and Unlock.
Lock - This button will lock device. Only this app's screen will show nothing else will be accessible even after restart same screen will show up. Home button, gestures will get disabled similar to single app mode.
Unlock - This will unlock device and switch to normal behaviour of device.
iOS :
I want this for iOS 4.3 and above.
I have checked following solutions, but these don't match my requirements
Configuration profile
Lock-down iPhone/iPod/iPad so it can only run one app
But it is manual (reboot device, open app which you want to run in single app mode). I want to do it programmatically the way i mentioned above through my app.
Guided access (iOS 6 and above)
How to lock down user to Single App mode in iOS 6, Programmatically?
I want it do for all os and programatically.
Is there any way to do this ? As i don't wan't to submit it to app store is there any private api, some hack for springboard to achieve this ?
Thanks in advance !!
As I know in iOS 7 there is a new feature which allow to do exactly what you want.
However, it's only applicable for iOS 7 (and I believe it's only applicable to a supervised devices).
1) You will need to install restriction configuration profile with autonomousSingleAppModePermittedAppIDs key (take a look here)
This is one time step and a user will need to manually accept this configuration profile.
There is another option to use MDM to install it silently, but it could be an overkill for you.
2) You should use API:
UIAccessibilityRequestGuidedAccessSession (to lock/unlock)
It is defined here
3) And most beautility part. All of it is officially document. So, you can even submit it to AppStore.
P.S. Why do you care about 4.3 or 5? They have tiny market share by now. Most likely even iOS 6 has below 20% market share already.
Update 1
Potentially, you can try to use API which sends clicks and keys (search for GSEvent in iPhone-privateapi tag). May be using these API's you can do triple home to toggle accessibility on and off.
If this work, I think you should be able to cover iOS 6. I am not sure whether both this API and triple home click were available prior that.
It looks like this private API is unaccessible anymore in iOS 7. So, probably you can ignore this idea.
Just wanted to write on this even though this is old as i needed to implement a similar solution and i got it working. The steps for me as follows and a note here is that this involves MDM and other specific steps.
My requirement was as follows. Each of the iPad at different locations has a set of apps installed.For ease of it lets assume each Dept. has their own apps. Participants open a app related to their dept. to take a test, the APP automatically Locks the iPad to single-app Mode and at the end of the test, it will unlock it self.
Supervise the iPad/iphone using the Apple Configurator.
Install the MDM related files ( Each MDM has its own set of instructions, usually involves downloading a profile).
Every MDM has a option of Single APP Mode or MultipleAppMode. Select the second option and add the app IDs to the list. (A single APP mode works pretty well with MDM's but i did not want the app to be locked to a single APP all the time).
I used the UIAccessibilityRequestGuidedAccessSession api to lock unlock the device from single app mode.
http://bobxcode.blogspot.com/2015/12/programmatically-implement-single-app.html
Thanks,
Bob
In MDM configuration, There is an option
autonomousSingleAppModePermittedAppIDs
Optional. Supervised only. If present, allows apps
identified by the bundle IDs listed in the array to
autonomously enter Single App Mode.
Availability: Available only in iOS 7.0 and later.
But this needs Supervised Device mode.

Resources