Adding an unattached UDID to existing project in XCode - xcode

Sorry, I'm sure this question is quite basic, but from what I've read I'm doing it correctly and still not having any luck.
I have a project in XCode. It compiles correctly and I can install it ad-hoc on all the devices that were originally part of the provisioning profile I created when I first started the project.
I now have another UDID that I need to add so they can test. They live on the other side of the country, so I can't attach the device and add it through XCode.
So from my understanding, these are the steps I have taken:
Over at developer.apple.com, add the UDID to the device list.
Update the provisioning profile on the developer website to include the added UDID.
In XCode, open organizer, select provisioning profile and hit refresh.
Recompile.
Am I missing a step in there? It recompiles fine but apparently won't install on the added device.
EDIT: I found This Post, which sounds like what I want, but I can't find the checkbox for "Automatic Device Provisioning". Where is that located?

It seems that the "Automatic Device Provisioning" checkbox has been removed from later Xcode versions, check this question: The Automatic Device Provisioning options have gone since upgrading to Xcode 4.3.1?.
The steps you listed seem good. You could check if the new profile has been effectively inserted into the ipa file:
- rename the .ipa in .zip;
- navigate into Payload and then contents of the .app package;
- open the embedded.mobileprovision file with a text editor;
- search for the new UDID string inside the file.

Related

Phonegap/Cordova to ipa file without Phonegap build

I use Phonegap Build to create my Android and iOS app files. However I want to compile the files locally on my computer, and not use Phonegap Build. I have done this successfully for Android (see here: https://cordova.apache.org/docs/en/latest/guide/platforms/android/) but iOS is more complicated. I have little Apple-knowledge.
Does anybody know of any good tutorials on how to import a Phonegap plugin in to the xcode environment...ideally one for someone who's background is NOT an Apple developer.
I have managed to do this myself but I've answered my own post to help others who may be in a similar situation - Please note this is correct as of end of 2019, and I had already successfully uploaded an IPA file to the app store via Phonegap Build before. All I'm doing here is compiling my Phonegap/Cordova project IPA file directly on a Mac, rather than using Phonegap Build:
1) You will need a mac and a developer license (as expected). You will be using both a terminal window where possible and Xcode.
2) Certificates and provisioning are a messy nightmare right out of satans bumhole. But just make sure you set up an "App store distribution" profile on your developer.apple.com account. If you don't know how to handle certificates and provisions please read here https://medium.com/ios-os-x-development/ios-code-signing-provisioning-in-a-nutshell-d5b247760bef.
But remember you only need to download the certificate to your Mac, and add it to your "My Certificates" area. The provisions can be automatically downloaded/linked to via Xcode.
3) Install Xcode 11 on your Mac. Forget all the other versions.
4) Install Cordova CLI on your Mac using the terminal - open up the terminal window and type:
sudo npm install -g cordova
5) Create a FRESH cordova project - dont try to be smart by shoe-horning the one you've already used on your PC:
cordova create hello com.example.hello HelloWorld
...you might need to to add "sudo" to the front of that. Don't copy and paste any html files or plugins in to it yet!
6) If your Mac might give you read/write access problems. So locate the entire folder, ctrl+click on the project folder, choose "get info" ...in the bottom right of the popup window click the lock icon and enter your password. Now change all settings to "read and write", then click the cog icon and select "Apply to enclosed items".
7) Create the platform : sudo cordova platform add ios#5.1.0....note, DO NOT use ios5.1.1 if you are using firebase or push notifications, as it seems to break with 5.1.1.
8) Apple will (again) probably give only read access to your new platforms/ios folder, because it hates you and wants you to suffer. So repeat step 6 if necessary.
9) Open Xcode the following way... In your projectname/platforms/ios/ folder locate the .xcworkspace file. This is the file you use to open your project. DO NOT use the .xcodeproj file because this is for older Xcode versions (and it will just break your whole damn project). Also go to File->Workspace Settings and ensure Build System is set to "Legacy Build System".
10) Now piece together your config.xml file by extracting the bits you need from your previous config file to your fresh new one. Don't bother moving over any android-specific bits.
11 a) Apple bring you a fresh slice of hell with cocoapods - a dependency manager for Swift and Objective-C. You'll need to install this if your app uses certain things like push notifications (firebase for example). You can install this via the terminal window. FIRST....close down Xcode. NEXT go to projectname/ and type: sudo gem install cocoapods. FINALLY go to projectname/platforms/ios/ and type pod install.
11 b) There's a bug...a pretty major one. Your cocoapods will fail when building at this point. So you need to do some hacking here. Navigate to the directory projectname/platform/ios/Pods/TargetSupport Files/Pods-yourproject and look for
Pods-yourproject.debug.xconfig and Pods-yourproject.release.xconfig
You need to copy the content of these files into platform/ios
pods-debug-xconfig and pods-release.xconfig respectively----THANK YOU kyale-mwendwa for this tip....https://github.com/phonegap/phonegap-plugin-push/issues/1825#issuecomment-359155007
12) Now copy and paste your www folder over in to your fresh project. You are ready to build your project...
13) Re-open xcode using the .xcworkspace file. Now you need to ensure your provisioning is set up correctly for your release. Click the project name at the top of the left-hand column (right above where it says config.xml). Now in the main window click your app name under the "Targets" section. Now select "Signing and Capabilities". If you managed to set up certificates and provisions correctly you should be able to select your "team" (no I don't know either, just select whatever option you can here), and enter the correct bundle identified (com.whatever.whatever).
14) Ok, you are ready to create your IPA file. Still have hair?? Bonus points for you!
Just before this next bit, go to Xcode and towards the top of the screen you will see the project name followed by "> iPad (7th generation)" or something similar. Click this and make sure you choose "Generic iOS device".
Now back in the terminal enter sudo cordova build ios. You don't have to transport your plugin files over from your windows-built cordova folder. Cordova will detect the plugins you need from your config.xml and install them appropriately.
15) If you have no errors you can now create your IPA file and even submit it directly to the App store (this bit of Xcode is actually really good). In Xcode, from the menu at the top click "Product" and then "Archive". Follow the onscreen instructions. At this point your IPA file is created.
You can choose to automatically distribute your file to the Appstore, but I suggest clicking the "Validate App" option first, which will re-request the correct certificates/provisions and give you a summary of any issues. If no issues you can click "Distribute App" and it will upload the IPA file to your Appstore Connect (formerly iTunes Connect) area.

2 Ad Hoc Distribution profiles with same name listed when I build my ipa

This stuff still confuses me. I added a device to my Ad Hoc profile in the developer portal, downloaded and double clicked the downloaded file. Nothing appeared to hapopen so I went into the Organizer in xCode 5, selected Editor->Provisioning Profiles->Import Profile.
Now when I build my ipa for distribution the profile is listed twice. I picked the first one in the list and discovered that it did not have the new device, so I redid the build, picked the second one and it worked as expected.
I do not understand exactly why I have gotten myself into this situation nor how to remove the old profile.
Here is what my code signing in xcode looks like. Should I delete and start over. If so which ones do I delete?
Thanks,
John
The best way to do this in XCode 5 is using an iPhone Configuration Utility. It lets you manually delete duplicates of provisioning profiles with ease and speed.
I keep Xcode closed when I do this just in case.

Cannot export developer ID signed Mac app

I am trying to build an update to my Mac app. As usual, I clicked Product>Archive then, in the Organiser, I clicked Distribute...>Export Developer ID-signed Application. Xcode finds my Developer ID, but it fails with the error "Code signing operation failed - Check that the identity you selected is valid."
This has never happened before, so I'm at a bit of a loss - I most recently exported a version of my App last week.
The only things that have changed are:
I have changed my Apple ID password
I added Cocoapods to my project and I'm now using the .xcworkspace file, rather than the .xcodeproj file.
I've tried refreshing the Teams list in the Xcode organiser, deleting all my Mac development and distribution certificates, restarting Xcode, and asking very nicely, but I'm still getting the same error.
You've done the right part in xcode, the only place that might be the problem is the Dev portal. Check your Dev certs in there if needs be you may have to remove those and request them again then sync them with xcode. That has worked for me before and might work out for you.
In case anyone ends up here, but still has the problem after checking everything in the dev center,
try removing extraneous files form the project. For me these were:
Gruntfile.js, karma-e2e.conf.js, karma.conf.js, and the entire node_modules directory.
see: How to build IPA for distribution with TestFlight with XCode 5?

How to make an IPA on XCode 4.3?

I have a Mac OS X Lion setup with XCode 4.3. I am not a registered Apple developer.
I told, via the plist files: /Applications/Xcode.App/Contents/Developer/Platforms/iPhoneOS.platform/Info.plist and
/Applications/Xcode.App/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/SDKSettings.plist, XCode not to require codesigning.
I then compiled my project, just a basic iPhone app project, it ran well in simulator. I could build and archive it, then sign it using a self-created certificate and the archive appeared in the Organizer.
Nothing strange for the moment, but there comes the problem: I have no "Share" button in the organizer. I absolutely need to make an IPA file out of my project if I want it to work under an iPhone as it won't accept xcarchive files. I only get the "Validate" and "Distribute" buttons which both require to be a registered Apple developer. But, no "Share" button which enables building an IPA... for free.
I have gone through XCode settings but nothing seemed to help me there. Even the documentation says a Share button is available in XCode 4.3, so my question is: Why don't I get the possibility to make an IPA? IS there any workaround to get this Share button or make an IPA out of the xcarchive via any command line or whatever?
Here's how you can make an IPA in XCode 4.3:
To Disable Code Signing:
Go to /Applications.
Right click on XCode and select 'Show Package Contents'.
Copy Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk/SDKSettings.plist to your desktop. (Make sure to actually copy and paste. No drag and drop)
Open it and under DefaultProperties set CODE_SIGNING_REQUIRED to NO.
Copy it back and replace the original file.
Restart XCode.
Open your project.
In Project Navigator select your project and open Build Settings section of your porject (and not any particular target)
Under Code Signing find Code Signing Identity and for both Debug and Release modes set Any iOS SKD to Don't Code Sign.
Now you should be able to build your project without any errors.
To make an IPA:
In 'Project Navigator' select Products
Right click on [NameOfYourProject].app and select 'Show in Finder'.
Create a folder and name it Payload
Move [NameOfYourProject].app to Payload.
Compress Payload and rename it to [NameOfYourProject].ipa
You should be able to get an IPA by clicking 'Distribute...' in Organizer->Archives, and choosing to 'Save for Enterprise or Ad-Hoc Deployment'.
Beginning iOs 5.1 Apple moved their files from /Developer/... to XCode->Show Package Content
In order to export codesign_allocate correctly run this line on your Mac terminal :
export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate

Entitlements are not valid

Recently, I have upgraded my iPhone SDK OS from version 2.2.1 to 3.0 version. After that, while building my application, I get an error that the provisioning profile has expired. So I created a new provisioning profile.
Then I made the distribution of my application with the provisioning profile. But I get an error in iTunes while synchronising my application into an iPhone device. The error message is "The application 'iGVA' was not installed on the iPhone because the entitlements are not valid."
I checked the code signing Entitlements contains the correct entitlement plist file.
How can this be solved?
Michael's answer above is spot on (or the link he points to is). Here are the steps I had to take to get it to work:
Have an ad-hoc certificate for which the device UDID is checked. Install that cert by dragging it onto the XCode icon.
On the project, create a distribution configuration and set your build params to the appropriate device | distribution. Right now, we build for Device 3.0 | Distribution.
My project did not include an Entitlements.plist file - I had to add it by selecting from the menu File | Add File | IPhone OS | Entitlements, and call the new file Entitlements.plist
The new plist file has only one row - set the value of that row to unchecked.
In the project build configuration, in the line for Code Signing Entitlements, enter the Entitlements.plist filename as the value.
In the Code Signing Identity, select the ad-hoc certificate identity (though I have found that you can also use your distribution certificate identity)
NOW BUILD :)
Deliver the resulting app file plus the ad-hoc cert to the person who gave you their UDID. Should work :).
An Entitlements.plist file is required for testers to install ad-hoc builds. The default iOS templates don't include one. In XCode 3.2.4 you create one like this:
From the menu, choose "File > New File…"
Under iOS Templates, there's a Code Signing section. Choose the certificate icon named Entitlements. Name the file "Entitlements.plist"
Select Entitlements.plist in your source tree.
Choose "View > Property List Type > iPhone Entitlements Plist"
Add a new key to the property list (select the top line, press return)
The item will probably be named "Can be debugged". If not, choose that from the available options. This is equivalent to "get-task-allow".
If you don't yet have one, create an 'ad-hoc' build profile:
Select your target in the source tree.
From the menu, choose "File > Get Info"
In the inspector. select the "Build" tab.
Under 'Configuration', choose "Edit Configurations…'
Select your 'Release' configuration, click 'Duplicate' at the bottom of the screen.
Rename the new configuration "Ad-Hoc Distribution"
Now you've created an Entitlements.plist, you need to add it to your build settings.
Select your target in the source tree.
From the menu, choose "File > Get Info"
In the inspector. select the "Build" tab.
Make sure the configuration selector is set to "Ad-Hoc Distribution"
In the "Code Signing" group, change the value of "Code Signing Entitlements" to "Entitlements.plist" - XCode may have put in a relative path for you. If so, change it.
Note - you'll have errors installing the app on your own device if you build & run with "Code Signing Entitlements" set for other build configurations.
Finally, check that the Entitlements.plist has been added to your target.
Select Entitlements.plist in the source tree.
From the menu, choose "File > Get Info".
Select the "Targets" tab.
Make sure the checkbox next to your target is checked.
You should now be able to distribute your ad-hoc builds without this error.
Most of this was gleaned from Apple's Managing Application Entitlements Guide, the rest by trial & error.
I got bit by this as well and found the answer in Ad-Hoc Apps and Entitlements.
You may need to make sure the path to your Entitlements.plist file is entered in your project settings under "Code Signing Entitlements".
I was getting crazy over this. Finally, I guess I got it. In project settings, I was setting entitlements and code signing stuff properly in the correct Adhoc configuration. However, although all seemed OK there, when I checked "Project -> Edit Active Target" my code signing entity was still stuck at "iPhone Developer".
After switching that to the correct "iPhone Distribution" and recompiled, Xcode asked me to allow code signing for the first time. And it all compiled and is transferred to my phone now!
I hope that helps. I seriously believe this problem is a bug or defect on Apple's side. I lost several hours for a simple thing, thanks to their undocumented IDE...
For record's sake, as all these wonderful answers didn't help me, I thought I'd share my Entitlements glitch.
So yes, I added UDIDs, got the provisioning, verified on the phone, in build settings, etc.
My glitch (thanks http://www.musicalgeometry.com/?p=1237) was that the Ad Hoc scheme was set as Ad Hoc configuration only for the Run settings.
For archive settings it was still pointing to the old Release configuration.
(These settings are the left side tabs in the edit scheme window.)
If I save someone my frustration - I've done my bit.
Code signing entitlements are no longer necessary for Ad Hoc builds in Xcode 4 - see details notes in Apple Technical Note TN2250
You also need to make sure that you have an unexpired provisioning profile, which foiled me on this one for a while (Ad Hoc provisioning profiles seem to expire after a year). Error message is the same, but it has nothing to do with not having a valid Entitlements.plist file.
Be sure that when you 'Build and Archive' that you are building for 'Device' and your configuration is not 'Debug'. It will seem to create the archive correctly, but will fail upon installing the .ipa the device if you are set to a Debug profile when you do the 'Build and Archive'.
This problem might not have anything to do with the Entitlements plist per se. I have two iPod Touches I use to test with. When I went to sync the apps with them, one worked perfectly, but for the other I got the 'entitlements are not valid' error. As it turns out, one device (the one that worked) had the mobile provision file on it, while the other one did not. This was an obvious oversight on my part. However, what threw me was I never explicitly added the provision file to the first device either. Not sure how it got onto that device (I'm still new at this - lol) - in the past I always just dragged it into the Organizer with the device attached, but I didn't do that this time.
So the provisioning profile and xcode were all set up perfectly with the correct IDs, etc. but the app still failed to sync. Obviously if the device isn't properly provisioned, you will get the error. Would be nice if the error was more helpful in this case.
I had this in XCode 4. I tried cleaning, deleting and recreating the entitlements file but still no joy. Then I changed the Value for "Can be debugged" from YES to NO .. and it worked. Anyway it seems to work fine now, I hope this helps!
This happened to me as well, and the other answers did not solve it for me.
After spending half a day building, installing, cleaning, clicking to no avail - I finally erased Entitlements.plist from the box under Code Signing Entitlements, saved, and typed it in again - voila! It worked again! I never touched the actual Entitlements file, just the setting.
I had this same problem, using Xcode 4. It turned out to be caused by a wrong selection for Identity in the "Share..." dialog in the (Archives section of the) Organizer.
The correct selection (for me) is: "Don't Re-sign".
I had this issue as well. As it turned out, sure I had edited a configuration to support ad hoc, and sure I was building using the distribution configuration. BUT. I hadn't edited the distribution configuration's properties, but the release's instead (I thought I was editing the distribution).
This might not be it. But even though you're certain, double check you're using the correct configuration, and that this configuration is adjusted properly.
From the docs:
Building an app for Ad Hoc
distribution is similar to building an
app for App Store distribution, with
an exception of two additional steps.
First, you need to create an Ad Hoc
Distribution Provisioning profile and
add the UDIDs of the iOS devices that
you want to distribute to using the
iPhone Developer Program Provisioning
Portal. Second, you need to create a
code-signing Entitlements file. For
information about how to create an
Entitlements file read the Managing
Application Entitlements section of
the iOS Development Guide.
Managing Application Entitlements
iOS provides access to special
resources and capabilities—such as
whether your application can be
debugged—through properties called
entitlements. To specify entitlement
information in your application, you
add an entitlement property-list file
containing entitlement definitions
(key/value pairs) to your project.
When you build your application, Xcode
copies the file to the generated
application bundle.
To add an entitlements property-list
file to your project:
In the Groups & Files list, select the
Resources group. Choose File > New
File. Choose the iOS > Code Signing >
Entitlements template. Name the file
Entitlements.plist. (You can use any
name; just ensure it matches the value
of the Code Signing Entitlements build
setting, as explained later in this
section.) Set the type of the
property-list file to iPhone
Entitlements. With the file selected
in the text editor, choose View >
Property List Type > iPhone
Entitlements plist.
Add your entitlement entries to the
file. For each entitlement property
you need to define:
Click the Add Child or Add Sibling
buttons to the right of the selected
row. The Add Child button has three
lines depicting a hierarchy, the Add
Sibling button has a plus (+) sign on
it. Choose the entitlement property
from the pop-up menu that appears. If
the entitlement you need to add
doesn’t appear in the menu, choose
View > Property List Type > Default
for File Type. Then enter the
entitlement-key name and type.
Enter the value for the property. Set
the Code Signing Entitlements build
setting for the target to the name of
the newly added entitlements
property-list file.
Once you
have created your Entitlements file
and added it to your Code Signing
Entitlements build setting, open the
Entitlements file and add or edit the
get-task-allow key and set it to
false.
In addition to compressing your .app
bundle to distribute your Ad Hoc build
to testers, etc. it is recommended
that you also compress the
provisioning profile before
distributing because certain email
clients and servers may corrupt the
provisioning profile.
For information about Ad Hoc
distribution please read the
Publishing Applications for Testing
section in the iOS Development Guide.
I just found another circumstance that causes this problem. You have to make sure you include the correct provisioning profile. I have an application that has both an iPhone and an iPod version, and an iPad version built from the same project. I apparently sent out the iPad ad hoc profile with the iPad version of the application, and it doesn't work. Worse, I installed the correct profile locally with Xcode, so everything works correctly on my machine.
I experienced a problem whenever I added a new device in the device list, and then made the new profiles by selecting the new devices and drag them to Xcode and prepare the build.
The moment I use that build for device installation I get the error
ENTITLEMENTS ARE NOT VALID
I tried to resolve it by all the ways I could think of but nothing positive came out. Anyhow, I have to make the new App-ID or have to repeat the whole process of creating profiles. Then I can install the build on the device.
make shure to select the Signing Identity in the TARGETS ;)

Resources