app store connect api download provisioning profile

Is there a way to download/generate teh provisioning profile file via the app stoe connect api?

The /profiles api lets me get teh profile content, but i need the profile file. (.mobileprovisioning) that I can use.

I am using bitrise and would like to automate the process of download provisioning profiles via the api. Even with auto code signing, don't we need to download(+install) the profile and cert(p12). Just that xcode will pick the correct ones from that matche the bundle identifier.

He is asking how to download the profile from app store connect api.


https://developer.apple.com/documentation/appstoreconnectapi/read_and_download_profile_information


There is a field (profileContent) containing a base64 string.


But I dont know how to decode it, there is no documentation about it.


I tried to decode the base64 string to .mobileprovision file and import that file to Xcode, but fails with the message Profile is missing the required UUID property.

Hello Angelbroz,

I am not sure if you have figured this out yet, but what I am doing is a two step process (working on a single line of code still) and using system tools to convert the base64 encoded content into a properly formatted embedded.mobileprovision file.


What I am doing is parsing the App Store Connect API response and sending the "profileContent" data to a temporary file and then decoding that file and saving its output to a embedded.mobileprovision file that is properly formatted. I am not sure what language you are using to interact with the App Store Connect API, but below is the code I am running in terminal to accomplish the generation of the embedded.mobileprovision.


base64 --decode ~/Path/To/File{.txt,.md,etc.} > ~/New/File/Path/embedded.mobileprovision


Let me know if this works for you, but if not, I would be happy to help troubleshoot!


@mbahl1234, I am not sure if this answers your specific question based off of your additional comments, but if you have additional questions on this I can help if needed.


Thanks!

Hey Chuck


I was able to generate the mobileprovision file with your solution.


Thank you very much!

that's what i've been looking for for days.

Thank you so much!

I'll put a correct mobileprovision on the computer desktop, and then put the profilecontent into 1.txt. Then I run base64 -- decode 1. txt > embedded. mobileprovision on the terminal. However, it fails and shows that the message profile is missing the required UUID attribute.

I tried above methods but still I couldn't generate the .mobileprovision profile using appstore connect api. could you help me to achieve this.

Thank you!

I found another solution. If you use Swift, you can set encoding with .isoLatin1

// codes

let data = Data(base64Encoded: profileContent)
let outputStr = String(data: data!, encoding: .isoLatin1)
try outputStr?.write(to: saveUrl, atomically: true, encoding: .isoLatin1)

it works fine in my application~

app store connect api download provisioning profile
 
 
Q