How to get local path in bitrise - ios

I have an iOS project in bitrise in which I have set manually manage signing.
So I have to provide my certificate in bitrise code signing section.
I put my certificate and provisioning profile in each subsection and now I have to provide the path from which me workflow step will take these certificates.
The step I use is the Certificate and profile installer
This is what it says:
URL of the certificate to download. Multiple URLs can be specified,
separated by a pipe (|) character.
You can specify a local path as well, using the file:// scheme. For
example file://./Cert.p12
In my case I want to take the local path but whatever I tried didn't work
(for example I tried with file://cert_id or file://cert_id.mobileprovision or file://cert_name etc)
Note: I don't want to do it via GENERIC FILE STORAGE.
Thank you in advance

As bitrise support helped me you cannot take the path like this.
My problem started when I had to provide more than one profile and certificate as I had more than one target and bitrise support up to 5 generic files.
So the answer is:
First of all upload all of your provisioning profiles (ad-hoc development appstore enterprise, if you will use one you can upload just one) in code signing section (you don't need anything in generic file storage).
Then add only one certificate and profile installer step and don't change anything.
Finally in Xcode Archive & Export for iOS step you have to navigate in Debug section and add a value in Custom export options plist content (this can be found when you archive and export an ipa locally in your machine by opening ExportOptions.plist file).
This is a sample of the value you will have to put:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>destination</key>
<string>export</string>
<key>method</key>
<string>app-store</string>
<key>provisioningProfiles</key>
<dict>
<key>bundleID</key>
<string>bundleID-provisioning profile</string>
<key>target-bundleID</key>
<string>target-bundleID-provisioning profile</string>
<key>target2-bundleID</key>
<string>target2-bundleID-provisioning profile</string>
</dict>
<key>signingCertificate</key>
<string>Apple Distribution</string>
<key>signingStyle</key>
<string>manual</string>
<key>stripSwiftSymbols</key>
<true/>
<key>teamID</key>
<string>yourTeamID</string>
<key>uploadBitcode</key>
<true/>
<key>uploadSymbols</key>
<true/>
</dict>
</plist>

Related

ERROR ITMS-90046: value 'Development' for key 'com.apple.developer.icloud-container-environment' is not supported

I'm getting the following error:
ERROR ITMS-90046: "Invalid Code Signing Entitlements. Your application bundle's signature contains code signing entitlements that are not supported on iOS. Specifically, value 'Development' for key 'com.apple.developer.icloud-container-environment' in 'Payload/AppName.iOS.app/AppName.iOS' is not supported."
"Development" isn't even in the entitlements.plist. There is the name of the iCloud certification though in an array of strings (this worked on the previous upload, I don't know what caused it to break). I've also tried deleting all certifications and provisions and redoing them. no change.
I've also tried the following to no avail:
ERROR ITMS-90164/90046: Invalid Code Signing Entitlements
https://forums.xamarin.com/discussion/48831/tinyurl.com/oqbw7ra
https://forums.xamarin.com/discussion/58051/ios-entitlement-error-90046
Suggestions?
EDIT:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.networking.wifi-info</key>
<true/>
<key>keychain-access-groups</key>
<array>
<string>$(AppIdentifierPrefix)com.PrivateAppName</string>
</array>
<key>com.apple.developer.icloud-container-identifiers</key>
<array>
<string>iCloud.com.PrivateAppName</string>
</array>
<key>com.apple.developer.ubiquity-kvstore-identifier</key>
<string>$(AppIdentifierPrefix)$(CFBundleIdentifier)</string>
</dict>
</plist>
Ended up removing the iCloud as I found a way to not use it. I used secure-storage and preferences instead. Note that the keys used to store them must contain the app identifier, for whatever reason, otherwise it doesn't always pick it up from the device (phone, tablet, etc).

iOS deployment fails with invalid entitlements - but entitlements are valid?

My colleague has made some changes recently to our app, and enabled Data Protection.
However, ever since, we're unable to deploy the app to any real device. The error happens at application verification with this error:
ApplicationVerificationFailed: Failed to verify code signature of /private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.YDQn6e/extracted/[appname].app : 0xe8008016 (The executable was signed with invalid entitlements.)
(Due to NDA requirements I have to hide any identifying information from any logs, and such, I replaced them with static labels in [] brackets).
I've checked the entitlements using Apple's own guide, using the security and codesign tools.
codesign output the following information:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>get-task-allow</key>
<false/>
<key>application-identifier</key>
<string>[teamId].[appname]</string>
<key>com.apple.developer.team-identifier</key>
<string>[teamId]</string>
<key>aps-environment</key>
<string>production</string>
<key>keychain-access-groups</key>
<array>
<string>[teamId].[appname]</string>
</array>
</dict>
</plist>
And here is the output of the security command:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AppIDName</key>
<string>[appPublicName]</string>
<key>ApplicationIdentifierPrefix</key>
<array>
<string>[teamId]</string>
</array>
<key>CreationDate</key>
<date>2017-07-06T11:55:52Z</date>
<key>Platform</key>
<array>
<string>iOS</string>
</array>
<key>DeveloperCertificates</key>
<array>
<data>[devCert]</data>
</array>
<key>Entitlements</key>
<dict>
<key>keychain-access-groups</key>
<array>
<string>[teamId].*</string>
</array>
<key>get-task-allow</key>
<false/>
<key>application-identifier</key>
<string>[teamId].[appname]</string>
<key>com.apple.developer.associated-domains</key>
<string>*</string>
<key>com.apple.developer.team-identifier</key>
<string>[teamId]</string>
<key>aps-environment</key>
<string>production</string>
</dict>
<key>ExpirationDate</key>
<date>2018-04-25T13:18:41Z</date>
<key>Name</key>
<string>[appPublicName]</string>
<key>ProvisionedDevices</key>
<array>
[provisioned devices]
[The device I'm trying to deploy to is listed here]
</array>
<key>TeamIdentifier</key>
<array>
<string>[teamId]</string>
</array>
<key>TeamName</key>
<string>[teamName]</string>
<key>TimeToLive</key>
<integer>293</integer>
<key>UUID</key>
<string>[id]</string>
<key>Version</key>
<integer>1</integer>
</dict>
</plist>
What on earth is going wrong here?
Updating entitlements in an iOS app requires a couple of steps if you are not using automatic code signing. You need to update both the application's project and the provisioning profile used to build the app. If the two are out of sync (or more precisely, if your app is trying to use an entitlement not allowed by the provisioning profile's allowed entitlements, you will get this error.
When changing entitlements, you need to update the entitlements in the project itself (as documented here) as well as in the provisioning profile. I suspect this is all you have done so far.
To update the entitlements in your 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 Data Protection. Once you have done this, click "Done". The App ID is now configured, but you'll need to regenerate your provisioning profile to pick up the changes to your app ID. Go to the Provisioning Profiles link on the left, find your profile for the app ID, click Edit, then click the Generate button at the bottom. Once done, click the download button to get the new profile that has the new entitlements for the App ID.
Also, just to be safe, I would delete all your old provisioning profiles from the Mac before downloading and installing the new one. That way you can be sure it is picking up the correct provisioning profile. You can find the location of the provisioning profiles here.

Export IPA for Testing instead Appstore with (ad-hoc)

i'm create All Devices in (3 iphone + 1 ipad)
Developer Apple account
i'm Generate certificate inf Developer Apple and i'm selected all device in this certificate
i'm download certificate and Generate in xcode . everything is good now
when i'm click in Build sitting => signin =>Provisioning Profile=>
its show this message :
The UUID of a valid provisioning profile. A missing or invalid profile will cause a build error (deprecated, use [PROVISIONING_PROFILE_SPECIFIER] instead).
however i'm exporte IPA with ad-hoc
and i'm see the code i'm change Myapp.ipa to Myapp.zip for lock the code
that what i'm se is there the all provisioning profile in the certificate
<string>iOS Team Provisioning Profile: com.myApp.name</string>
<key>ProvisionedDevices</key>
<array>
<string>653125008b5277640d4f640ab94241a4</string>
<string>h5856dd83f2e34952cae17eb849736ef6</string>
<string>945a65b488deb77903ab9cc335bc2a9b0</string>
<string>6654f70cc52dab5c371c22b63e200e916</string>
</array>
when i'm add the ipa to my IPhone or IPad is not installe is give me erore so what is wrong ?
Thnak you for your time to reading all this :)
Make sure you've followed all these steps, then you should be good to go.
Give it a try and let me know!
On developer.apple.com:
navigate to your account & login
click Certificates, IDs & Profiles in the side menu on the left
on the left, find Devices & click +
register multiple devices by uploading a spreadsheet including the UDIDs and names of the devices
follow the steps to finalize the registration process
You might need to wait 24 hours; I found, it sometimes takes really long for the changes to take effect.
Inside Xcode:
prep: open Xcode settings, accounts, your account and then re-download all the profiles and certificates
archive the product
open the Organizer window and find the archive you've just created
click Distribute App
choose Ad-Hoc
make sure to have include manifest for OTA installation enabled
follow the steps
finally, click export and choose a location to save the files
Upload all the files (icons, .plist & .ipa) to your server. Note that the server needs to be https, this is mandatory. If your's isn't, upload it to Dropbox or some other cloud service. If you're using Dropbox, make sure to replace www.dropbox.com with dl.dropboxusercontent.com.
Manifest
open the manifest.plist file and insert all the new urls
again, for dropbox: replace www.dropbox.com with dl.dropboxusercontent.com
upload the manifest plist to a secure server.
Link:
itms-services://?action=download-manifest&url=https://dl.dropboxusercontent.com/s/YourURLHere/manifest.plist
Taken from here.
You should use automatically manage signing.
For that you should select your team.
In navigator click on your project name - under targets - you will find signing section.
In that check the checkbox for automatically manage signing and select your team. If you have not any team available then you can add it from Preferences of your xcode -> Accounts -> + -> add your apple developer id and password.
After selecting team it will automatically create provisioning profile if your developer account includes your bundle id!
Make sure your device is connected with xcode!
When I exporting to ad-hoc, I created a simple WEB with manifest file. This file will generated automatically when you exporting app to AD-HOC. Thanks this web site you can install app from internet.
Sample code for WEB:
<html>
<a style="font-size:48px;margin-top:150px;margin-left:250px;float:left;color:#22788D;"
href="itms-services://?action=download-manifest& url=https://yourAppServer/manifest.plist">Install your APP </a>
</html>
Sample of Manifest.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
<key>kind</key>
<string>software-package</string>
<key>url</key>
<string>https://yourServercom/YourApp.ipa</string>
</dict>
<dict>
<key>kind</key>
<string>display-image</string>
<key>url</key>
<string>https://yourServercom/Icon.png</string>
</dict>
<dict>
<key>kind</key>
<string>full-size-image</string>
<key>url</key>
<string>https://yourServercom/iTunesArtwork.png</string>
</dict>
</array>
<key>metadata</key>
<dict>
<key>bundle-identifier</key>
<string>UserAPP.YourApp</string>
<key>bundle-version</key>
<string>1.0</string>
<key>kind</key>
<string>software</string>
<key>title</key>
<string>YourApp</string>
</dict>
</dict>
</array>
</dict>
</plist>
It works perfectly for me.
Good luck!

itunes connect - beta entitlement missing error

I create a new App Store Distribution profile containing the beta entitlement to distribute builds via TestFlight, I create my application based on new profile that was contain beta entitlement, when I submit my application I got this error:
Generate a new App Store Distribution profile containing the beta
entitlement to distribute builds via TestFlight
Here is my provision profile:
<key>Entitlements</key>
<dict>
<key>keychain-access-groups</key>
<array>
<string>XXXXXXX.*</string>
</array>
<key>get-task-allow</key>
<false/>
<key>application-identifier</key>
<string>XXXXXXX.my.companyname.test</string>
<key>com.apple.developer.team-identifier</key>
<string>XXXXXXX</string>
<key>beta-reports-active</key>
<true/>
</dict>
I have "beta-reports-active" in my build, I do not know why I got this error I regenerate everything, does apple change/add something to the submission process/test-flight after 1 February without announcement?
Does anyone knows what is the problem?
Thanks in advance
I fixed this issue by additionally adding the beta-reports-active key to my Target's Entitlements.plist file in the Xcode project.
Apple TestFlight upload warning ITMS-90191: missing `beta-reports-active` entitlement
The beta-reports-active key must be added to the Provisioning Profile AND to the Target's entitlements.
TargetName.entitlements:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
// ...
<key>beta-reports-active</key>
<true/>
// ...
</dict>
</plist>
After adding the entitlement to my Target, I'm able to successfully upload the build to iTunes Connect TestFlight without the ITMS-90191 warning:
I'm using Xcode 9 and Swift 4
I also faced same issue when I try to create ipa file for my swift project. I search a lot but could not find any good solution. But finally my senior helped me same way as pkamb said in his comment, adding key "beta-reports-active" in your projectName.entitlements file will solve your problem. Open projectName.entitlements file as source code and edit it as follows.
My projectName.entitlements file looks like this
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beta-reports-active</key>
</dict>
</plist>
I just added key :- beta-reports-active as shown above.
Xcode 10: you must not add the beta-reports-active manually to entitlements if you want to use Xcode automatic signing.

Using launchd on IOS to restart app

I am using some iPads in a museum exhibition, running an app developed by others. Even though we've covered the Home button, I'm finding that occasionally the app crashes, leaving the user at the Home screen. From here they can access other unauthorised apps.
The museum is not averse to jailbreaking the iPad if that will give us the solution we require, so I have been doing some research into the idea of using launchd with the KeepAlive tag and putting the .plist file into the /Library/LaunchAgents directory to prevent the app closing or re-spawning it if it crashes
So far I have had success making it work with the default apps that come with the iPad and also Cydia installed apps but I can't get it to restart the app that we want. I have tried it from the /User/Applications directory and also /Applications, which someone suggested might make a difference but no joy. Can someone suggest a possible solution or am I wasting my time? I've inserted the XML from my plist file below.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.MVFieldguide.launchd</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/Field Guide 2010.app/Field Guide 2010</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<true/>
</dict>
This won't work because App Store applications are not kept in the Applications folder. I can think of two options.
Install AppLinks in Cydia. This will create symlinks of every App Store app and puts them in /var/mobile/AppLinks. Then in your plist file put the path to the application as
/var/mobile/AppLinks/Field Guide 2010/Field Guide 2010
Instead of installing the app onto the iPad conventionally, you can get the ipa from Xcode and extract the .app bundle. Then manually install it into /Applications/ and you'll be able to use your launchd plist the way you have it.
I recommend the first option because it will allow you update the app without manually putting the .app bundle into the Applications folder. Using the first option won't change your workflow for updating the app at all.
Also, just be aware that if you do this, you'll have to remove the plist before updating the app to quit it, as I don't think you can update an app while it's running.
iOS 6.0 may have some kind of fix for locking the device into a mode... I DON"T KNOW (NDA)
a hacked iOS 5.1 can still do the following:
user the app with the bundle identifier....
you can open calculator with com.apple.calculator.... no need for folders!
here is the script you put into launchd folder...
Install the Open app from cydia first so you can use the "open com.apple.calculator" terminal command
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<false/>
<key>Label</key>
<string>com.perceptdev.tink</string>
<key>ProgramArguments</key>
<array>
<string>open</string>
<string>com.orbitusrobotics.thegatekeeper</string>
<string></string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StartInterval</key>
<integer>10</integer>
<key>WatchPaths</key>
<array/>
</dict>
</plist>

Resources