synching a team provisioning profile to an iPhone - ios

I have a test version of an app on my phone which has stopped working last week when its team provisioning profile expired. The profile is now update in Xcode and on the developer portal but not yet on the phone. Is there any way of forcing an update on the phone which our reinstalling the app and overwriting its [slightly changed Core Data] data store?

If you've set up your core data version correctly, it should not overwrite the data store. If you are currently developing it, and the core data data store version hasn't been incremented, can you not increment the version to force iOS to migrate the data to the new structure?
Barring that, you have 2 or 3 options to install it, depending on how the profile is set up.
If you are using a wildcard app ID in your provisioning profile, you can get the new version onto the phone by simply creating a new dummy app (or use one of Apple's sample apps) and sign it with the new profile / cert. This will get the new profile onto the device without touching the existing app (just make sure you don't use the same bundle ID for the dummy app.
If you have an explicit app ID, you can try to add the provisioning profile manually through the Xcode Devices window. Right click on the device on the left and select "Show provisioning profiles..." In the window with the provisioning profiles, click the little "+" below the list, browse to your provisioning profile and open it. If it is valid for the device, it will get added on the device.
Finally, if you have MDM (Mobile Device Management) managing the device, you can use that to push the profile to the device.
Once you get the profile on the device, you should be able to run the app again.
Unfortunately, Apple no longer allows you to simply email the provisioning profile to the email account on the device and let the user open it. I believe starting with iOS 8 you haven't been able to do that and you need to install it either with an app, through Xcode, or with MDM.

Related

Signing iOS App: App ID Cannot be Registered to Your Development Team

I need to replace a deployed iOS native app with a new Ionic3 / Cordova hybrid app. The new hybrid app builds successfully (on macOS Sierra 10.12.6) but I can't sign the app (so that it can be uploaded to the app store).
As a first step, I'm focused on getting the new app on the app store (as alpha to test with TestFlight). I've removed all "development" certificates/profiles from developer.apple.com.
There's a lot of information/questions/answers on the web about signing apps. I've spent a couple of days on this issue and cannot get it to work no matter what I read or what I try.
The current iOS app code (deployed)
In Info.plist, $(PRODUCT_BUNDLE_IDENTIFIER)
In /bbh.xcodeproj/project.pbxproj, PRODUCT_BUNDLE_IDENTIFIER = "NSP.BBH-Mobile";
Re-create development provision
Open Keychain. Delete all developer/iPhone certificates. Delete all keys.
On developer.apple.com, delete development certificate and development provisioning profiles.
Confirm my iPhone device is registered with the correct UDID.
In Keychain, generate a certificate signing request file.
In developer.apple.com, create a development certificate, upload the certificate signing request generated in the previous step, download the certificate .cer file.
Double click on the .cer file. Keychain opens. Choose to add to "log in".
In Keychain > certificates, choose export, specify the strong password. Certificates.p12 file will be generated.
In developer.apple.com, create a development provisioning profile. Choose "iOS App Development". Choose an App ID ... but which one?
App IDs in developer.apple.com
BBH Mobile = com.bbh.*
BBH Mobile = NSP.BBH-Mobile
Xcode iOS Wildcard App ID = *
Notice on-screen reads:
"If you plan to use services such as Game Center, In-App Purchase, and Push Notifications, or want a Bundle ID unique to a single app, use an explicit App ID.
If you want to create one provisioning profile for multiple apps or don't need a specific Bundle ID, select a wildcard App ID. Wildcard App IDs use an asterisk (*) as the last digit in the Bundle ID field.
Please note that iOS App IDs and Mac App IDs cannot be used interchangeably."
We need push notifications so choose an explicit App ID = AYW4J8P7X3.NSP.BBH-Mobile
app id = team id (generated by apple) + bundle id (supplied by the user)
It makes sense to choose this App ID which includes the bundle id of the iOS currently deployed.
https://www.screencast.com/t/C0QdPdxwh09t
Choose a development certificate (just created), choose all devices.
Download the development profile and double click to install (in Xcode).
Double-clicking doesn't seem to do anything? How do I know it's installed in Xcode correctly?
Do I need the .mobileprovision file on my iPhone? The mac server is in the cloud so I don't have my iPhone connected via USB to the mac.
Open Xcode. Confirm my apple account added in Xcode > Preferences > Accounts. In the project, targets, signing, click "Automatically manage to sign".
Choose my personal team. The following errors are displayed:
Error 1: The app ID "NSP.BBH-Mobile" cannot be registered to your development team. Change your bundle identifier to a unique string to try again.
Why does it prompt to change bundle id? Isn't it standard to have one app id and to generate both a debug/development and release?
Error 2: No profiles for 'NSP.BBH-Mobile' were found Xcode couldn't find any iOS App Development provisioning profiles matching 'NSP.BBH-Mobile'.
But we just created a new development provision and selected App ID = NSP.BBH-Mobile. Why doesn't Xcode recognize this?
you may try unselect Automatically manage signing and import provisioning profile manually.
These are the steps I took to finally resolve this issue. It may not be optimal but it at least worked.
1. In Xcode, turn off automatically manage signing.
2. For signing (debug), select my development provision profile.
3. For signing (release), create a production provision profile, then select the new production profile.
Notes/Observations:
Even though I only wanted to create a signed debug for testing it seems I still had to provide valid signed release provision too.
Even after deleting all keys/certificates etc. and starting from scratch it seems Xcode has created a certificate too. Annoying - it's difficult to tell who created what now.
There was no need to change the bundle ID from the original iOS native app being replaced.
Creating a new production provision did not affect the existing production provision (which I could not use because I don't have the key).

Does adding a new device to Apple Developer account make it available to every app?

I want to add a new device to my list of devices under "All" in Devices category in Apple Developer website in order to have that person download and install an app of mine for testing.
I did a test run of uploading the .IPA file of a different app to Diawi with the devices as they currently are in my list of devices so without adding this new one, and all three devices showed up in list of provisioned devices. I had not added them specifically to the app ID, it was just an app I created on the fly for testing which was associated with my own developer account.
Now, I am just wondering, if I add the UDID of another tester under "All devices" and then proceed to add it to the distribution profile of my app, if they would then stay in the default list for future apps?
I really don't know how this works - would really appreciate if someone can help me out on this part.
Assuming it is a standard development provisioning profile (and not an enterprise distribution profile), this is how it works.
One of the things inside of the provisioning profile is a list of devices on which apps that apps matching the bundle ID (also specified in the provisioning profile) can run. So if you have a new device, you need to add it to the apple developer account, then add it to the provisioning profile you are using to build the app, re-download the profile to your Mac, then re-build the app. The new app will have bundled with it the new list of devices on which the app is authorized to run. Then give the new app to the person with the new device and it should now work for them.
If you try to run the old app, which has a profile that doesn't list the new device's UDID, the app will not run. Also, simply adding a new device to the list of devices does not automatically add it to any provisioning profiles. You must then go and edit the profile to choose to include the new device. Then, once you've done both of those, you must download the profile and then rebuild the app, now packaged with the new profile that includes the new UDID.

How to run iOS application in real device through terminal without a paid apple developer account?

First this not duplicate of Test iOS app on device without apple developer program or jailbreak
I know it is possible to run app on device using Xcode 7 and free AppleId but i want to achieve this using terminal only Or in other words, Is there any way to generate provisioning profile & certificate using unpaid Apple Id through terminal.
If i will follow mentioned steps then my app installed and run successfully in device but i want to generate IPA using this free certificate and provisioning profile using terminal only.
In Xcode, add your Apple ID to Accounts preferences, described in
Adding Your Apple ID Account in Xcode.
In the project navigator,
select the project and your target to display the project editor.
Click General and choose your name from the Team pop-up menu.
Connect the device to your Mac and choose your device from the
Scheme toolbar menu. Below the Team pop-up menu, click Fix Issue.
Xcode creates a free provisioning profile for you and the warning
text under the Team pop-up menu disappears.
Click the Run button. Xcode installs the app on the device before launching the app.
I am working on some automation task and want to generate and install this signed iPA using unpaid Apple Id through Terminal.
I do not believe this is possible. The challenge is not just extracting the provisioning profile that is created in Xcode. That will not work because Xcode also manages the devices in the profile. So if your devices change, you need Xcode to register the new device and add it to the profile on Apple's servers, before re-downloading it. It also manages the bundle ID.
In theory, if you were to set up the app and all devices in Xcode before grabbing the provisioning profile from ~/Library/MobileDevice/Provisioning Profiles, maybe it would work.
If you can successfully get the profile. maybe you can use these instructions to build and install on the device as long as it was set up ahead of time: install application in iphone device through command line

iOS: Bundle format unrecognized, invalid, or unsuitable

When I try to run an iOS app on real devices it give me the following error, but it works on simulator, also I uploaded test build on TestFlight successfully, I tried to use another bundle identifier but no luck.
The project is built using Swift and using CocoaPods to include Alamofire and other libraries.
Without having all the details it sounds like you need to update your Provisioning Profile for Distribution or Development.
You will first need to go to the Apple Developer portal and login in to your account. Then select "Certificates, Identifiers and Profiles", followed by "Devices". Add your iPhone's name and UDID to the list if it is not there already.
After your device is registered to your account you will need to update the Distribution Profile (to allow devices to open your app through the beta distribution channel of Test Flight) as well as your Development provision profile to allow team members to build and run the app through xcode on their device instead of the simulator.
First select Distribution and click on the preexisting Distribution Profile for your application. Select the edit option and make sure the check mark next to your device is selected. Then generate a new Distribution profile. This will cause a download to automatically occur in your browser window. Once its complete you should click the download and this will automatically add it to xcode.
Now create a new provisioning profile for your application. Add the appropriate App Bundle Id and select your device from the list. Generate the new profile and a download will again be triggered in the browser window. Once the download is complete again click the download which will automatically add the profile to xcode.
Your application should now be able to run on your device when building and running through xcode as well as when it is downloaded from your beta distribution channel.

Automatic device provisioning in Xcode 4

I am currently trying to test my application in my iPhone. Currently I am using xCode version 4.6.3 with an iPhone 4 and a developer account. I have read from some sources that Apple has made an easier alternative for developers to test their application on their device with the introduction of Automatic device provisioning in Xcode 4. So this saves the hassle of creating Ad Hoc & iTunes App Store distribution. However in my current version of Xcode, there is no such function and is instead replaced with a refresh button that prompts for your developer credentials. Does this works the same way as the Automatic device provisioning that was present in the early versions for Xcode 4?
So another question in order test my application on my device, do I just need to :
1) Click on the refresh button in my Xcode organiser.
2) Enter my developer credentials
3) New profile appear in the list with the name "Team Provisioning Profile: *"
4) Select my device name from the scheme
5) Build and run
Or do I have to go through creating an App ID and a provisioning profile in the developer website and change the Bundle Identifier in the plist to the one which i created in the developer website? ?
You either need to go through the procedure of creating certificate, app id (or wild-card), provisioning profile, or you need to upgrade to Xcode 5.
Doing it manually is much easier than it was a few months ago.

Resources