Run release build of iOS app on development device - ios

When I build my iPad app for running on my development iPad, it only builds the debug version. I need to see how fast the real release version is; how do I do this? I'm used to Visual Studio's Debug/Release builds, so this Run/Test/Profile/Analyze/Archive stuff isa bit confusing. I see Schemes are related to this but isn't there a simple switch "I want to test Debug/Release version of my app on my device"?

You want to do a release build using an ad-hoc provisioning profile, which will allow you to install it on your device and any others you have specified.
Test flight app is free and can help with this process as well.

In your scheme settings, you can select to build for debug or release. Make sure you have set up code signing correctly. Xcode 5 can help with that.

You can create a new Build Configuration in the Project View under the Xcode Project. Make it a duplicate of Distribution
Then just choose Edit Schemes and choose the new scheme and run on your device. Make sure you the certificates selected in your Build Settings. However you don't get full Debugging capabilities when running a AdHoc/ Distribution build.

This took me a really long time, but I got it working. I usually use automatic signing and it works great. I switched to using FastLane in order to speed up the test flight distribution process and it required that I switch to manual signing. I had to change my release signing certificate to iOS Distribution.
I then had a bug that was only reproducible in release mode, so I needed to run the app on my device in release mode, but it was a pain to keep re-uploading to test flight.
I tried changing my build system to legacy, but that didn't work. I read up on profiles and certificates and I realized that I need to use iOS development certificates to run on device directly (which is what I was doing in debug mode). However, I needed to use iOS distribution certificates to distribute the app. Automatic signing had been taking care of this for me.
I ended up just turning on automatic signing briefly to test my app and then turned it back off and used git to revert the status of the workspace.
TLDR: turn on automatic signing and then turn it back off when done testing

Related

Cannot build iOS ad-hoc in Codename One

While testing how Codename One iOS build works I found no way to make an ad-hoc build. I gave my Apple Developer credentials in CN1 to be used in the build process and CN1 correctly gave me the option to select the unique devices I had set up at the Apple Developer end. I got no errors and everything seemed to be ok.
However, after that process the only options I had for an iOS build were "debug build" and "Appstore build", the latter being grayed out. If I decide to move to CN1 I really need the ad-hoc option because the apps are definitely not going to the app store but installed through enterprise delivery channel(s).
So how can one do an ad-hoc release build? Or is it possible at all?
In Codename One Settings under the "iOS Signing" section you should see these options:

Xcode 8 A valid provisioning profile for this executable was not found

I know there are other questions asked like this here but I've followed all their solutions yet still end up with this error message.
I have a valid Apple Developer account with program active.
I have tried using managed and unmanaged provisioning with new/fresh bundle ID's (which get recreated provisioning profiles).
I have tried this: A valid provisioning profile for this executable was not found for debug mode
I have tried this: XCode :7 App installation failed :A valid provisioning profile for this executable was not found
I have deleted any old versions of the app from my phone.
I have confirmed my device ID on the developer portal is the same as in Xcode (was also useful for manual provisioning profile management to confirm)
I even tried another developer ID I have out of sheer desperation and yet the same error appears.
I even get this error when building for release scheme with my valid distribution certificate.
I've spent a ton of time trying to figure this out now I'm hoping someone else has felt my pain and actually solved this.
UPDATE: Adding screenshots for usefulness
UPDATE 2: I gave up trying to solve this problem, I created a new project and copied source files into the new project and I now have it working. Clearly something in the project configuration/settings files got corrupted somehow in the previous project which no obvious fix available. Will leave this question open, perhaps someone has a solution eventually. I have my old 'non-working' project so will continue to try those just for curiousities sake.
Before this error message, Build Succeeded is shown.
ATTENTION!
Who should read
If you were developing with a "Personal Team" and is switching to a paid team, then you'll get this error if you have not updated your other targets as well.
The cause
Since I'm using react-native, I happen to have a target for test (i.e. a target called appTests), and switching the team just in one target wasn't sufficient, and leads to this error. This error isn't informative enough to let you know there's an error in one of the targets, therefore leading to a long debugging time for myself.
Solution
1) On Xcode 9, go to every targets and update the team!
2) Unfortunately, the next steps aren't very reliable from my experience, you might have to do your best to clean the caches.
3) Stop every single running scheme/application by using the stop button
4) Go to Product -> Clean and cleans every schemes you use.
5) Quit and Restart Xcode
6) Run again and hopefully it works! If not, it's likely some cache are still present.
You can't install a build that was signed with the app store distribution provisioning profile and certificate (I'm assuming your release scheme is set to use your app store cert and profile). It will fail to install on the device if you try. You need to use either a development profile, or an enterprise distribution profile to install on test devices. The iOS Distribution certificate can only be used to build an app that will be installed via the App Store.
Thats a conflict of Xcode. The way I solved it is by deleting the derived data of Xcode.
Xcode > Preferences > Locations
You will see an arrow right from the path of the DerivedData which will open them in finder. Just erase everything in the folder.
Update: According to Chandler's comment check if there is a need to delete the test target.
I solved it by changing the build system to legacy in Xcode 10
File > Workspace Settings > Set Build system to "Legacy Build System"
It works when I also add the correct signing for myProjectTests. This was the last thing I did after trying all sort of solutions for 5 hours.
I followed many proposals but it didn't work until I unchecked Automatic signing for the TESTS
Clearing the DEVELOPMENT_TEAM and DevelopmentTeam entries in the xcodeproj/project.pbxproj file worked for me.
I'm on 8.2.1 and just had this same error. Deleting the original project folder and recreating it worked seamlessly. I verified that all of the signing and provisioning certificates were exactly the same as the last project. I'm not sure where the issue lies, but I believe your assumption of corrupted files is accurate.
In my case it was a conflict with the development team.
I've solved by opening my xcodeproj/project.pbxproj and emptying the following variables:
DevelopmentTeam
DEVELOPMENT_TEAM
We had a similar issue: we deleted the Unit Tests and it worked.
In my case, it was the problem when I setup my time manually two month earlier on my iPhone. But when I changed to set time automatically, it worked fine.
Setting -> General -> Date & Time -> set time automatically
GOTO: Targets->yourProjectNameTest and verify that team is the same as on yourProjectName
I had this problem too, and for me the solution was to sign in to https://developer.apple.com. There was a red bar, going like "our TOS have changed, you have to accept them again", I did, and then my provisioning profiles worked again immediately.
An easier fix is to uncheck the test target as part of the Analyze & Run steps in Edit Scheme > Build -> Build.
This is very specific to React Native projects, since this is how the projects are configured by default.
In my case it worked for me to follow the instructions in this article. Then disable Automatically manage signing inside xcode in the general tab.
Automatically manage signing disabled
And finally provide manually Provisioning Profile for Signing (Debug) and Signing (Release)
Note: The Provisioning Profile you must generate it from Apple Developer Program website, in the section Certificates, Identifiers & Profiles -> Provisioning Profiles
I hope you find it useful. regards
Step to be followed
must have a developer account - https://developer.apple.com
create a certificate for development
Add devices with UDID
add provisioning profile in development
sign in Xcode with your account
clean build
Build with any destination choose device I have done for iphone 6
the archive will be disabled first, the archive will be active by choosing
generic ios device from the right corner of Xcode for example ->
yourAppName>generic ios device
once archive is done build for development not ADHOC
done
I fixed it by setting in main Target / Build Settings / Section Signing
Code signing Identity: Debug and Release set to IOS Developer
Code Signing Style: Automatic
Provision Profile: all automatic.
I set this exactly same for Test Target.
Then i was able to run release version on my phone. Btw i dont know what is the difference between IOS Developer and iOS Distriobution though.
I had edited my app scheme Build Configuration from Debug to Release, and unchecked the Debug Executable.
I am not sure why, but if it makes a difference my signing details for Debug and Release were different. So after I reset those back to Debug and checked back the Debug Executable box, and all was fine again.
Edit: found out it was because I was trying to run release mode on my phone via App Store provisioning profile and App Store profile doesn't allow this. I switched to Ad Hoc and there is no more issues.
I guess you already tried this, but I just got the same error, and a quick restart of Xcode worked for me.
Just upgrade to Xcode 8.1. It solves the problem.

Instruments stopped working on iPhone apps

I had used Instruments tool (an Xcode developer tool) to analyze iOS applications before with no issues. But now when I try to run it on any iOS app (for instance CNN), it is giving me following error.
"Target failed to run: Permission to debug com.cnn.iphone was denied. The app must be signed with a development identity (e.g. iOS Developer)."
Is there any work around? Is it not supported anymore in new version of Xcode? Few months ago, I was able to use it on all applications including CNN.
Just edit a Profile section in target scheme. Switch Build Configuration to Debug.
Assuming that you are using the Release configuration to run in Instruments (as recommended), you need to review the code signing and make sure that Release is configured to use your Developer identity (instead of Distribution, for example).
First click your target
Choose Edit Scheme...
Select Profile and make sure Build Configuration is what
Here, my Build Configuration of Profile section is AdHoc. Don't change this selection to Debug, cause in Debug mode, it won't be optimized by compiler like AdHoc or Release.
Then come to Build Settings, change the Certificate and Provisioning Profile.
From this picture
To this picture
It's done!
The application (one wants to run Instruments libraries on) has to be in running state and then select from the 'Running Applications' category and not from the 'Installed Apps' category and that should work.

Add Developers in Xcode

Assume I have an Xcode project running on Github and multiple developers. I have a new developer who will clone the git repository and start working on the app. I want to add his iOS devices as devices that can run the builds without having to reissue certificates and do all that long process on the iOS Dev Center. How can I do that? I want him to clone the repo, connect his device to Xcode and be able to run the app on his device.
Thanks
If he is a paid iOS developer and there is no reason to use a specific provisioning profile you won't need to do anything. Xcode can automatically provision his device when he compiles it. Just use the automatic profile selection for your development builds in the build settings.
If it is important that you both use the correct provisioning profile (for example to test push notifications) there is no way around adding his device to the profile on the developer portal. Plus you will need to let him sign the binary as you, using your developer certificate and private key (which you will have to export from Keychain on your development machine).

Problems with code signing for ad-hoc distrubution for iPad App

I've been trying for a weekend now to install my application via ad-hoc means for beta testing and demo purposes. I can install from Xcode just fine, but when I try and take the app file and place it into iTunes, then try and synch, I keep getting the error "The application was not installed on the iPad because it is not signed".
I have gone through all the steps. We went to the provisioning portal and added all the devices. We then downloaded a distribution provisioning profile and installed that onto the development computer. We created an Entitlements.plist file, though there was no get-task-allow attribute, so I had to add in my own. I cleaned the targets, restarted Xcode, built the application under the ad-hoc profile with the Entitlements.plist set for the Code Signing Entitlements.
I take the app file that's generated and drag it into the Applications area of iTunes, hit synch, and I get the error.
I know I am doing something wrong, missing a step, but it must be a convoluted, obscure step that Apple doesn't have in their documentation. So can anyone see the problem in what I'm doing? If you could, let me know. Thanks.
Ok. Yay. Figured this out after some more hair-pulling.
Apparently, the build you follow is important. I kept testing and building to the Simulator folder, and this is wrong.
To deploy to a device, you should clean all targets and then build specifically to the device. You don't have to run it or have something plugged in, but you must build to device. The APP that is produced is different for simulator as it is for device.
Did you set the "Code Signing Entitlements" build setting in your target to "Entitlements.plist"?

Resources