iOS add targets to existing application with fastlane - ios

I would like to extend an existing application with a production and a test target with more of prod / test target combinations.
The applications are based on the same source code and are configured with different .plist files and config files, so its really just a new target which is needed (along with all the profiles and stuff...)
There is an existing fastlane setup (with environment files .env.App1), but I don't know to which extend this was used to create the app and the portal stuff.
I extended this setup with a new .env.App2 file and added the desired bundle id and started the app creation with
fastlane create_app --env App1
where lane create_app simply calls
create_app_online
This worked fine and the application id was created on the apple side.
Now I have a problem with the signing part.
In the project "automatically manage signing" is active.
When calling sync_code_signing for the same environment everything goes fine, but the signing stuff is not solved in xcode for this target unter signing & capabilities.
I have the certificates in the according git repo (this problem was solved in another question, if somebody struggles with that)
How do I solve these 3 errors?
Failed to register bundle identifier
The app identifier "com.BUNDLE_ID" cannot be registered to your development team because it is not available. Change your bundle identifier to a unique string to try again.
Provisioning profile "iOS Team Provisioning Profile: *" doesn't support the Associated Domains and Push Notifications capability.
Provisioning profile "iOS Team Provisioning Profile: *" doesn't include the aps-environment and com.apple.developer.associated-domains entitlements.
What all these different apps need are
Associated domains
Background modes
Push notifications
So i have a .entitlements file, a .plist file and a target for each app.
How can I find out what the problem is and fix the signing part for all my apps / targets?
thank you

Related

IOS application, ID bundle errors on XCode

I created an application with the Ionic Framework that allows me to make hybrid applications.
When I open my project on XCode, I have errors from XCode that I can not solve.
My errors are:
"Automatic signing is unable to resolve an issue with the target's
entities file"
"Provisioning profile ios team provisioning profile * doesn't include the aps-environment entitlement "
"Code signing is required for product type 'Application' in SDK 'iOS 10.3' "
I think the ID bundle has a mistake, however, I do not understand how to solve it.
How do I create a correct ID bundle without going through the project creation box since mine is already creating basic? (My ID bundle was generated by the global application's in the config.xml file)
Is it necessary to have a paid developer account to be able to create one? Or can I test my app simply on my phone?
Thanks in advance!
These errors you are getting because of the no Provisioning profile & Developer Certificate.
To Brief of what is provisioning profile & Developer certificates are, These are security certificates providing by Apple to make sure that the iOS application is built by identified developer.
If you see there is a check mark: "Automatically manage signing" on.
Because of that, it's trying to create provisioning profiles and
certificates automatically without any proper apple membership
account. That results in an error.
To run on a device, you don't need to have paid account. Any Apple ID will work. You need to have at least normal Apple ID and have to put any random bundle identifier there to run on your iPhone. (You can follow this link to How to run on iPhone without certificates)
Answering another question of yours: Yes, it's required to have Apple paid account to create a Bundle identifier. Even if you test it now on iPhone using above trick, to distribute in future to AppStore you need one.

Wrong iOS provisioning profile being chosen

I have followed a tutorial to enable Push Notifications on the App. It's still in development phase and internal testing only.
Using that, I have correctly enable development push notifications on the App ID, and the development provisioning profile accordingly. So much that the first three or so bundles that I have uploaded worked correctly and the Push Notifications went just fine.
Now, with the last update I've done, I've received an Email with an issue and the Push Notifications stopped working:
"Missing Push Notification Entitlement - Your app appears to include API used to register with the Apple Push Notification service, but the app signature's entitlements do not include the "aps-environment" entitlement... etc."
What I realized since then is that when I run "archive" to build the app, after I choose the team (the only one I have and always have used), when I come to chose the Binary and Entitlements, the Provisioning Profile is a DISTRIBUTION one and not the development one I have created.
I've tried countless things from my search on the internet. Including forcing in Code Signing on my target Build Settings the iPhone Developer:MyName and the development profile I've created in the Provisioning Profile row (wich is available to select here).
Still, no-go. I have no idea what changed in the process since I didn't mess with certificates or changed anything in that field, just plain app code.
Thanks for the input.
EDIT: I'll add some screenshots that maybe can shine some light.
The XC:profile is the default distribution provisioning profile that XCode is creating.
Note : without knowing the root cause i can only help you confirm whether you have all the certificates on proper place and using correct one.
Please go this way..
Just check in your Keychain and developer.apple account, if developer certificate is valid, if yes then
Check Provisioning profiles for Development and Distribution with Notification service enable in Provisioning section on developer.apple account.
So far everything is proper then.
Go to Xcode -> Preferences -> account -> refresh all certificate for the same apple account. and hit download.
Now go to Project settings -> general -> confirm you should have selected appropriate team.
finally to to project settings -> build settings -> search "code signing"
now select correct Provisioning profile and developer here.
please let me know if you find any trouble in this.
In my case, I had changed the bundle identifier for the app, but the App ID listed on the provisioning profile was still wrong. Turns out that in the "Packaging" section under build settings, there's another place where the bundle id needs to be changed ("Product Bundle Identifier"), and that's what the code sign-y thing was looking at.
Using Local Signing assets while exporting solved the issue for me

Xcode The executable was signed with invalid entitlements [duplicate]

This question already has answers here:
The executable gets signed with invalid entitlements in Xcode
(40 answers)
Closed 2 years ago.
I would install an application in my mobile phone by using Xcode but it was not installed with following an error message.
Error Message
"The executable was signed with invalid entitlements.
The entitlements specified in your application’s Code Signing Entitlements file do not match those specified in your provisioning profile. (0xE8008016)"
Matters of Inquiry
Why does the error message occur while I install the application?
Would you mind if you can give me the solution of this problem?
Check if you are using Entitlement file in Build Setting > Code Signing Section.
If yes, try deleting that file name.
You are using Entitlement file
The entitlements file defines certain capabilities of your app. Usually, the file is automatically generated by Xcode when you enable a capability for your app. You only need the file if you enable certain capabilities, e.g. Healthkit integration. If you'd like to use these features, you have to add it. Otherwise, Apple will reject your app.
To fix this
Go to the build settings of your target.
Make sure that you have "All" selected instead of "Basic"
Type "entitlements" into the search box
The result is the build setting where you can specify where your
entitlements file is located
Remove them
You are using the wrong Provisioning Profile
A provisioning profile is a collection of digital entities that uniquely ties developers and devices to an authorized iPhone Development Team and enables a device to be used for testing. A Development Provisioning Profile must be installed on each device on which you wish to run your application code.
Go to Build Settings > Code Signing > Provisioning Profile
Select a development profile under Team
Please ensure that the Team in the project, target and tests are the same.
Bundle Identifier and App ID do not match
Go to the build settings of your target
Select Packaging and change your App ID to match the Bundle ID
Clear cache in Xcode
Command-Option-Shift-K to clean out the build folder. Even better, quit Xcode and clean out ~/Library/Developer/Xcode/DerivedData manually.
You are using wrong provisioning profile to build your app on devices make sure you are using right type of profile. I was using App Store Deployment profile to build on devices. Use ad-hoc profiles or development profiles to build on your devices.
You are using the wrong Provisioning Profile i.e. Distribution for development. Go to Build Settings > Code Signing > Provisioning Profile and select a development profile.
Check the if your "Code Signing" configurations are same on "PROJECT>Build Settings" and "TARGETS>Build Settings".
Personnally, I use for both:
- "Code Signing identity": iOS Developer
- "Provisioning Profile" : Automatic
Check your "Team" parameter at your targets. It should be the same for your project and tests.
For me none of the above answers worked. I tried to remove every code signing certificate from Keychain and build the app. When I resolved all code signing related errors for my target I still had some of them in Tests target. It has been set by someone else from my team before. I just switched to iOS Developer, and the invalid entitlement error went away.
I was getting this problem after moving app from one account to another. I tried all the solutions given by others, those might be correct in other cases. But I fixed the problem by going File -> Workspace Settings -> Build System and choosing "Legacy Build System". I'm using XCode 10.3.
I faced this problem and my problem was My Bundle Identifier and AppID was not matched. Please change your Bundle Identifier in Build Settings->Packaging like your AppID.
Just goto Apple developer portal from where you have downloaded provisioning profile.
Select your profile click edit and check whether all certificates are selected or not.
In my case selecting all certificates and downloading that new profile solved the above mentioned issue.
Also make sure in your schema you have set "Build configuration" to the correct configuration, in most cases "Debug".
I got this error when export the ipa with App Store provisioning wrongly during CI process. My intention was to export with Adhoc provisioning.
I had the same error. My problem was that I checked 'Enable HealthKit' in Entitlements.plist, but I did not enable HealthKit when I created the App Id.
In short, all entitlements in your app (Entitlements.plist file in your project) should be configured on the provisioning profile you use (Provisioning profile = app ID + certificate + information about devices your app can run on).
Had the same problem that suddenly popped up in my project from one day to the next.
What fixed it for me was turning "Automatically manage signing" off and on again for both targets and making sure the right development team was selected once it was on again (defaults to none in my project).
It could seems a easy solution but I solved updating my iPhone's iOS version.
All answers I have seen talk only about xcode update. It was strange because my old iOS version was iOS 13.3.3 and it worked on another iPhone with iOS 13.6. After updating to iOS 13.7 it worked.

Code Signing for AdHoc Beta Testing

I have been working this for past two days, and haven't come up with a solution. I have Created Provision for Distribution in Apple perfectly. I don't know How to Set up Built setting and Code signing process in Xcode 5. Any one who could explain briefly will be appreciated.
Assuming you have created certificate and a distribution profile.
First, download both the profile and certificate from your developer account. Just double click on them and it will get copied to respective locations automatically.
Now open your project settings and under build settings tab look for Code signing section.
Set the certificate and profile which you have just installed.
Do the same under Target-> build settings.
Next, you need to set the bundle identifier with which you have created the app id in developer portal. Note down the Bundle ID, version info and set it in Target -> General
If everything went well archive your code and distribute the ipa file which is now code signed.
Refer here for more details.

Need to force Xcode 5 to not use wildcard provisioning profile

I'm trying to use the new Automatic Configuration in Xcode 5 and it seems that when I run builds on my iPhone it is downloading the wildcard provisioning profile and using that to run the app. This is no good because my app uses push notifications and the wildcard will not have the correct entitlements to register for push notifications.
Is there a way to specify to use the provisioning profile for the qualified app id so I can test push notifications?
Strategies I have considered:
Delete wildcard app id - You cannot do this
Delete wildcard provisioning profile - Xcode will recreate the wildcard provisioning profile
Specify the provisioning profile explicitly in the target's build settings
I don't know how to determine the explicit name with Xcode 5. I could download and open the profile in a text editor, but that can't possibly be the right way to do this
If I specify the provisioning profile, I will need to update it every time a new profile is generated (add a new device, profile expires, signing certificate expires). This defeats the purpose of automatic configuration.
I've poked around Xcode looking for such a setting and haven't seen anything useful
I have followed the steps here (for configuring Push Notifications) and when I refresh my provisioning profiles they are not updated.
Any ideas?
Xcode was not downloading the provisioning profiles because it did not find any app id MATCHES. It did not find any matches because the capabilities in the "Certificates, Identifiers, Devices" website did not match the capabilities listed in the project in Xcode. Because the app identifier has In-App Purchase and Game Center enabled on the website but once I enabled it in the project it automatically downloaded the relevant provisioning profiles.
Hope this helps someone else.

Resources