How to use Fastlane to enable capabilities in provision profile? - xcode

Our org uses Fastlane to manage out codesign stuff. We have the github repo set up and been using it for a while.
For Xcode13 we added time sensitive usernotifications capability to our entitlement file.
<key>com.apple.developer.usernotifications.time-sensitive</key>
<true/>
From my research it seems like we have to re-generate the provision profile. How can I achieve this with Fastlane?
is using sigh the right way? I am hesitating to do any actions because all the iOS dev share the certificate git repo, so I am being very cautious.

The following worked for me
update the entitlements in provisioning profile, log into the Apple developer site and go to the "Certificates, Identifiers & Profiles" section. Select Application IDs on the left, and find the app ID for the app you are trying to build. Click the edit button and turn on the entitlement for Time Sensative User Notification (or whatever you need to add)
Run Fastlane match to regenerate the profiles
fastlane run match type:"<enterprise or development>" git_branch:"<internal or production>" generate_apple_certs:"false" git_url:"<link to your fastlane cert repo>" then follow the prompt.

Related

How to generate *.ipa file

First I apologise for my english.
could you help me with small problem :slight_smile:
I want to create *.ipa file from ionic project, but in indentify area xcode told me that I must "Fix Issue".
And if I click on the fix issue, so xcode show me modal window with text An App ID identifier "com.xxxxx.xxxxxx" is not available please enter the different sting, but I need use defined string, concretely defined string in "Bundle indentifier".
What can i do? Could somebody help me width this problem?
I try to change "Bundle indentifier" e.g. com.xxxxx.xxxxxx1. I add only 1 to end and it works but I need use Bundle identfier without 1 number in the end of bundle identifier string.
And one thing under Team item I have text "No provisionig profiles found", but if i add 1 to the end of identifier bundle and click to Fix Issue this text "No provisionig profiles found" disappear.
Thank you for any advice,
best regards Peter
You need to have an apple developer account with enough access to do the following:
Create a development/production certificate
Create provisioning profiles based on the above certificate
In order to be able to build an *.ipa file you need to do the following:
Create the development/production certificate
Add the UDID of all devices on which you want to run the *.ipa install
Based on your choice you need to create a provisioning profile for either Development or Ad Hoc distribution.
Archive your project
Time to create your distribution:
if you chose Development, it's rather straight forward, just follow the steps (disable "Rebuild from bitcode" for faster build) - after this you can e-mail the build, but the build will need to be installed through iTunes on a device whose UDID you've added above
if you chose Ad Hoc, you need to upload your build to a remote HTTPS location, along with the corresponding manifest (*.plist) file (if you need further instructions on this, I can help, don't want to go into too many details if this is not what you want)
The "Fix issue" shows every time when your device UDID has not been added to the provisioning profile of the app bundle ID that's been set within the app.

None of the valid provisioning profiles allowed the specified capabilities: Features: inAppPurchase

I have working application in AppStore. It has inApp Purchases.
Certificate and provision profile was expired.
I updated it, but XCode wrote:
"Code Sign error: No matching provisioning profiles found: None of the valid provisioning profiles allowed the specified capabilities: Features: inAppPurchase.."
I pressed "Fix Issue Automatically", XCode wrote
"An App ID with identifier 'com.mycompany.myproj' is not available. Please enter a different string."
This indefinier is bundle id of my application, and I did not change it.
How to fix this error?
I fixed this problem next way:
remove all provision profiles which links with problem project (using «iPhone Configuration Utility»)
generate new provision profile on developer.apple.com
download and install this provision profile (and updated expired provision profiles) on local computer
choose new provision in "Code Signing Identity"
build project

This application's bundle identifier does not match its code signing identifier

When I try to build and run the app on the device I get following error App installation failed: This application's bundle identifier does not match its code signing identifier.
I checked the signing certificates, bundle ids, provision profile, entitlements and everything is correct.
Any Ideas ?
Go into Building Phases
Click the + sing and add script in New Run Script Phase
Add /usr/local/bin/carthage copy-frameworks to the script box.
In Input Files add a line for each Carthage framework you're using in your app: $(SRCROOT)/Carthage/Build/iOS/FrameworkName.framework
If you're still having problems, also add this under Output Files for each framework: $(BUILT_PRODUCTS_DIR)/$(FRAMEWORKS_FOLDER_PATH)/FrameworkName.framework
This process fixed it for me. It can be found under Carthage documentation. You can see this process here in items 4, 5, 6.
https://github.com/Carthage/Carthage#adding-frameworks-to-an-application
In the end the error was caused by Carthage.
After removing and rebuilding all frameworks it fixed the problem.
To fix this, I had to set framework's Product Bundle Identifier to anything with a dot.
In my case it was because of framework, not Carthage's, but the one as target dependency in Workspace.
Before the fix Product Bundle Identifier was something like "FrameworkName", andXcode would automatically append some autogenerated ID, and Signing Identifier would become "FrameworkName-5555494493d11a8e5f473d1cb2a5d781973d171e".
When I set Product Bundle Identifier to something with dot, like "com.organization.frameworkName", Xcode stopped to auto-append anything, and everything works because ids match.
It seems that it wasn't an issue before Xcode 11 and Catalina. This debug was crazy.
Are you using custom .xcconfig files?
Sometimes custom .xccofigs can override the default code-sign settings.
1) See if the project has a custom config by:
--- 1) Click on project whatever the project name is called in Xcode (usually at the top)
2) On the right you'll see your project settings. In here, you can set the identifier.. If not, then you're on the wrong view. This is what you should see:
3) Change the "bundle Identifier" to something to the effect of "com.yourcompany.yourAppName".
--- The com.yourcompany is your website domain name reversed.. Apple Recommend this.
--- After the com.yourcompany is the app name or "nickname' your give it so. com.yourcompany.myCoolApp would be the full identifier.
4) Once you've done this, make sure that under the "Build Settings" as below:
--- That your "Code Signing Identity" is set to whatever Identity you want. For Debugging on iOS or OSX you use "iPhone Developer: Your Name xxx" or "Mac Developer: Your Name xxx".
Code signing resources path: reserved for advanced / command line tools
Other Code Signing Flags: Not sure, never had to use this
Provisioning Profile: IDEALLY set this to "Automatic" so Xcode handles the setting. Otherwise, when you've set a provisioning profile on the Member Centre, then specify it here (make sure you've installed it first though).
in iTunes they changed it to have a flag for each role if he will have
Access to Certificates, Identifiers & Profiles.
and by default its false.
All i had to do is to:
go to iTunesConnect -> Users and Access -> edit my role by checking the box of "Access to Certificates, Identifiers & Profiles"
This issue is only related to CODE SIGNING
But, the key point to note here is, if you are using XCode 11.x version.
Not only the code signing in your project, but we should check the code signing in Thirdparty SDKs or dependencies that we add to our project.
Steps to verify the Code Signing of 3rd party SDks:
Download the source code of framework you need
Open the .xcproj file from the source code using XCode 11.x
Go to Targets -> Signing & Capabilities -> Select all tab -> Bundle Identifier
If you see any unevenness in the identifier like, identifier with 4 seperators (Eg: com.company.mac.app)
Change it to com.* and enter.
Make sure your XCODE COMMAND LINE TOOLS is set with XCode 11.x
Now, use below command to rebuild the SDK, with the changes done in above step-3
carthage build --no-skip-current --cache-builds --platform iOS
Now copy the framework generated from, carthage folder of source code, and replace the existing SDK in your project.
Repeat the same for process for all the 3rd party SDKs, in your project.
NOTE: Make sure you marked all the 3rd party SDKs as Embed & Sign in
Targets => General => Frameworks, Libraries, and Embedded Content
Your app is signed by a Provisioning Profile, which in turn is linked to a Certificate (which can be either for development or distribution).
Now certificates have a Bundle ID, which can be:
A wildcard, such as "com.mydomain.*"
OR
An explicit ID, such as "com.mydomain.myapp"
Either way, the bundle identifier of your app has to match the Bundle ID of the certificate tied to your provisioning profile.
A mismatch would trigger the error you're encountering.

Provisioning for Distribution

I can run the app fine through the development profile but I can't run it through the distribution profile. I have everything setup correctly as far as I can tell. The error that I get from xcode on compile is:
Code Sign error: No unexpired provisioning profiles found that contain any of the keychain's signing certificates
and in TARGETS > Release > Any iOS SDK I look under what should the correct line item and I see the following:
Profile doesn't match any valid certificate/private key pair in your keychains
So it sounds like my current cert doesn't allow me to run my app as distribution? I went into the member center and dirtied all related profiles and restarted xcode 4.6 after updating my profiles. Doesn't seem to work.
I also checked my Info.plist and the bundle name is correct there. It's also correct in TARGETS > Summary > Bundle Identifier.
A private key is missing
I noticed this morning that there is no private key underneath the iPhone Distribution cert in my Keychain Access and I suspect that's an issue? I'm an admin in the developer portal so I'm not sure why this wouldn't be working..
If you weren't on the distribution certificate when it was signed then you need to have someone who IS on the certificate to export their cert + private key for you. If in doubt, it's probably the dev portal agent who you need this from. The details are found in the answer for the question below:
Profile doesn't match any valid certificate/private-key pair in the default keychain

How-to remove Embedded Provisioning Profile

A client assigned to me an unfinished project from another developer. I finished the project however i can not upload it to the app store because it has an "Embedded Provisioning Profile". How can i resolve this issue?
p.s. I tried to change the embedded profile following this answer https://stackoverflow.com/a/3097199/975799 but it didn't work.
Change bundle id of the application. Create your own bundle id, app id and provisioning profile. Install your profile and sign this app with your profile. It should work

Resources