How can i export app file in Xcode - ios

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.

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.

Programmatically erase iPhone's data swift

I am developing an iPhone Application to wipe all data from iPhone including photos, videos, contacts, messages, apps, etc. programmatically. I wish to achieve this with an iPhone Application only.
The approach I am thinking of somehow I manage to Clear data from iPhone and rewrite the memory with some junk files or binary data 1010 say. (Its just an idea!)
All I have managed to do is delete photos from Photos which are further not deleted from Recently deleted folder in Photos App.
Also, I found this Programmatically How to wipe out iPhone or iPad data in i phone apps in i phone apps which declines it's feasibilty.
But, Is there a way to programatically restore my iphone to factory settings? says using the C files mentioned here https://github.com/lite/osxrce/blob/master/resetapp/main.m can may be make it possible. They say they tried it on a jailbroken device though.
What you are hoping to do isn't possible on an non-jailbroken iPhone. You will be violating the iOS sandboxing among other things.
A similar outcome may be possible by creating your own MDM server, and building your app to interface with it. On first installation of your app, you can have it install the MDM profile. The app can then feature your 'Wipe' button which can signal to the MDM to send a wipe push notification to the device.
It would take a lot more work that what you're asking about, but it should be possible.
Reference: https://developer.apple.com/enterprise/documentation/MDM-Protocol-Reference.pdf
Apple do not allow to delete files which aren't created or part of your application, so you will not be able to delete data of other apps.
I don't think you're allowed to do that anyway. Even if you were able to do it, it would not be accepted on the app store.
You can backup the iPhone via AppleMobileBackup.exe -b, then modify the according
database file(such as addresscontacts, messages), and restore the modified ituensbackup files to the iPhone via AppleMobileBackup.exe -r.

Build on device from Xcode versus downloaded from TestFlight - Issues

I have an issue when running my project on my device, but only if it has been downloaded from testFlight. It works fine when I build directly from Xcode to device.
Potentially relevant details -
Using AVCaptureSession, my app records segments of video where it can switch between front/rear camera etc. I have handled orientation of each video so when playing back or merging with multiple videos they all play the correct way round.
The playback orientation works as expected on my devices when I've built directly from Xcode. Though from the app dowloaded from Testflight, the orientation of the videos are wrong way round.
Devices used iPhone 5S - 8.1 & iPad 2 7.1
As mentioned, this is only an issue from TestFlight builds. I've not posted any code as logic works fine from Xcode. I have used TestFlight a lot over the past year and not come across an issue like this before. It only seems isolated to this video playback.
If anyone has had similar issues and knows how to resolve or has suggestion, that would be much appreciated.
I discovered why my testFlight build was acting different from my Xcode build and it all came down to Build Configuration settings within Xcode
I edited scheme which which brought up build options and within the Run option I changed Build Configuration from Debug to Release.
Although this never solved the video issue, it did allow the app to act as it would on release. I will now be able to continue test of my issue, but thought other people experiencing differences in their Xcode and test builds may wish to know about this setting.
Do you happen to be using Swift. Apple changed their certs and added an extra field as part of the process. Existing certs do not work when including external libraries that include Swift code. I lost a good chunk of time to this. Here is the explanation form TestFlight competitor AirSign.
https://www.airsignapp.com/ios-apps-using-swift-crash-when-signed-with-inhouse-certificate/
If this is the case, the conclusion is generate a new cert and a new provisioning profile using the cert. You may have to revoke your old cert if you have too many.
If you build directly from your machine you are using your development Cert. If you go through TestFlight you are using you distribution cert. What happens if you take the distribution ipa that you are about to upload to TestFlight and try to install that directly onto you device. IF you can not install the app then there is an issue with your distribution cert. I also assume you tried building a new hello world type app and going through TestFlight and then adding AVCaptureSession in a new build of the app and trying that.
To make my life easier I use iFunBox to directly install test ipas directly on my machine bypassing iTunes. Great free app. Just launch, Choose Install on Device and choose the ipa
http://www.i-funbox.com/ifunboxmac/

Get app data from Appstore build

I want to be able to plug in any device that has my App on it and download the app data for my application. Is that possible?
I have a device that has the app store version of my application and I want to get the application data off of it.
I plugged in a device that is not added to my development account. I then add it to my dev account by going to Xcode organizer, selecting the device in the left-hand pane, and then clicking "Add to Member Center". After the whole process completes, I click Applications, but I don't see the existing app store version of my application available.
I then try to run my application on my device and it ends up deleting the existing App store version which causes all the data to be lost. Is there a way to get the existing app store app data off of the device?
===== edit ====
I'm looking to get the data manually, like I would if I had the app available as one of the options in the Applications tab underneath the device name in Xcode Organizer.

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