When specifying provisioning profile in fastlane gym for ios do i supply the profile name or the path to the file? - fastlane

How do I set the provisioning profile int he export_options for gym in fastlane? I have my profiles in my Documents folder. Does gym automatically locates it or I need to specify the path to the file? I know using match is the preferred way but right now I'm still asking permission if I can upload provisioning profiles and certs in git. So in the meantime I'm doing it without match. Can someone help me with this. I'm new to fastlane and I'm not a swift dev.

How do I set the provisioning profile int he export_options for gym in fastlane?
A: If you run xcodebuild -help you will see the available keys for the export options and their configuration:
provisioningProfiles: For manual signing only. Specify the provisioning profile to use for each executable in your app. Keys in this dictionary are the bundle identifiers of executables; values are the provisioning profile name or UUID to use.
Does gym automatically locates it or I need to specify the path to the file?
A: Yes it does, in the same way than Xcode does, since gym is kind of a wrapper for "xcodebuild" command (the one that Xcode uses of course). So by providing the name or UUID should be enough. Of course this means that the provisioning profiles should be downloaded on your machine, Xcode -> Preferences -> Accounts -> Download Manual Profiles should do it.
You can see this lane as example:
desc "your description"
lane :release do
gym(
workspace: YourApp.xcworkspace",
scheme: "YourApp",
configuration: "Production",
output_name: "YourApp.ipa",
export_method: "app-store",
export_options: {
signingStyle: "manual",
provisioningProfiles: {
"YourApp.bundle.id" => "The name of the provisioning profile",
"YourApp.bundle.id.OtherExecutable" => "The name of the provisioning profile"
}
}
)
end
I don't want to create another repro to host only the certificates and stuff so I prefer to do it manually too.
Understanding how the signing works fro iOS can be a little tricky, this article helped me a lot to fully understand it. If you want mode details feel free to ask :)

Do a manual build, export with Xcode and copy the generated ExportOptions.plist file

Related

Archiving the project from terminal

I have seen posts regarding building a project from terminal.But I would like to archive the project and create a .ipa file in the specified folder of my wish.
For that, I presume I need developer certificate, provisioning profile, sdk, architecture, projectName etc.
I could specify below things,
Project Name: I go to project folder or I will give the path
SDK: ios4.0, likewise.
architecture: arm6,7 etc.
But how should I specify certificates? Should I give paths with names or Ids.
And are there anything more have to be done for that? I mean plain layout of what has to be done, would be very helpful.
Thanks in advance.
Think this is what you're looking for: Xcode “Build and Archive” from command line]1

Code signing in project settings, target settings and re-signing after creating the archive

I have seen a few questions similar to this. So the target settings override the project settings. I got that, but if I don't want to override the project settings, is that what the "Don't Sign" option is for?
What am I supposed to do after archiving my app, when it asks if I want to re-sign it? If I have set the signing at the project or target level, should this be set to "Don't Sign"? What happens if I elect to re-sign it? Does the signing done during the previous archiving step get overridden and replaced with the new choice?
Can I look into an archive (.ipa) file and see what provisioning profile was used? I don't see the option in Finder to open it like I can open other bundles. How can I do this?
Just unzip the ipa (unzip appname.ipa) and do the following on the results:
codesign -dvv Payload/appname.app
It should show you the cert used.

The identifier "EventApp" in your code signature for EventApp must match your app's Bundle ID

i'm trying to publish my first iphone app (monotouch) to to the store but i always get the following error after uploading:
The identifier "EventApp" in your code signature for EventApp must match your app's Bundle ID "net.mydomain.myappname".
I have the following settings in monodevelop configured:
Bundle identifier: net.mydomain.myappname
I have also tried changing this identifier to "net.mydomain.myappname.EventApp" (similar to this screenshot: http://monotouch.net/#api/deki/files/29/=dist-app-settings.png) but then i can't build anymore because monodevelop shows the following error: "Build failed. Array index out of range"
I also had a look in the Info.plist file in the build-output folder. (EventApp.app)
This is what's in there after build:
Bundle name: EventApp
Bundle identifier: net.mydomain.myappname
Executable file: EventApp
Another trial was to rename the project to "myappname" but this didn't also work.
Is there another location somewhere in the *.app package where the identifier could be?
Any ideas how to fix this?
thanks
Be sure you use the correct app store provisioning profile created for the specific bundle id. The bundle id that you used to create the profile should match the bundle id provided in the itunes connect while creating your application there. Use the same bundle id in all the 3 places.
1. Creating provisioning profile
2. Info.plist
3. ItunesConnect

Name of Provisioning Profile used to sign an iPhone app?

I wrote a script that uses xcodebuild to generate an AdHoc build of an iPhone application.
I would like to edit this script to output the name of the Provisioning Profile used to sign the build.
This would allow me to include the Provisioning Profile in the zip that is automatically generated. This way, I could automatically send the archive to the AdHoc testers and be sure that they have the right Provisioning Profile to install the app.
Is there any way to extract the Provisioning Profile name or file used to sign the application:
from the builded and signed application
from the Xcode project (I don't want to manually parse the project.pbxproj file, as this solution might break in the next Xcode update)
any other way that is scriptable
Unforgiven suggested to use the command security to get the name of the certificate used to sign the app. Once you have this information, is there any way to then find the name of the Provisioning Profile?
Here is what I tried:
Sadly, the output of xcodebuild during the build does not contain this information. During the CodeSign step, there is the line:
/usr/bin/codesign -f -s "iPhone Distribution: My name" ...
but I can't match this with a certificate.
I looked into using codesign, and the command /usr/bin/codesign -d -vvv --entitlements - -r - /Users/lv/Desktop/TicTacBoo.app/TicTacBoo looked promising, but it doesn't give me the information I need.
I haven't found any useful option in xcodebuild either.
The provisioning profile is already in the application. You don't need another copy in your zip file (unless your testers do not understand how to use the copy inside of the application.)
It's named YourApplication.app/embedded.mobileprovision
This doesn't answer your question because the original filename is lost, however it does seem to solve your bigger problem.
You can use the "security" command from the terminal; unfortunately, at least on my MBP with Snow Leopard it appears to cause a segmentation fault in one of the commands you need to issue. For more information, issue from the terminal
man security
Anyway, here is what you can try, assuming your development/production certificates are stored in the login keychain:
security unlock-keychain login.keychain;
security find-certificate -a -c "iPhone Distribution: Your name" -p > cert.pem;
The second command causes the segmentation fault (caused by the -c argument), but it should be exactly what you need. Alternatively, you can use
security find-identity -p codesigning -v;
to get a list of all of the valid certificates you can use to code sign your applications.
For each certificate, the output also contains the SHA1 message digest, so that you can easily search the certificate in the keychain matching the SHA1 digest associated to "iPhone Distribution: Your name". This however, requires that you write your own application using the keychain APIs.
Let me know if this works on your mac or if you experience the same segmentation fault issue.
EDIT/UPDATE: I have verified the bug on other machines and filed a bug to Apple.
How about looking in the _CodeSignature/CodeResources plist file (of the built application) for files of type "mobileprovision"?
Here's a way to do that using defaults(1) to read the plist file. You have to copy the CodeResources file to something with the ".plist" suffix to keep defaults happy...
cp /build/Distribution-iphoneos/MyApp.app/_CodeSignature/CodeResources /tmp/defaults.plist
defaults read /tmp/defaults files |grep .mobileprovision |grep -v embedded.mobileprovision
(in my test case, there were 2 .mobileprovision entries there; ignore the one named "embedded.mobileprovision")

iPhone Xcode project.pbxproj + Subversion = code signing issue?

Try to commit my first iPhone application to Subversion found that there's "code signing identity" section in my xcode project.pbxproj file.
CODE_SIGN_IDENTITY = "iPhone Developer: my username here...;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: above...";
The issue is, in our team we use different provisioning which bound to our device. So when other want to run the code on device, they have to change this line. We can share one provisioning to across this, but that way have several downside. Is there any other way to solve it? i.e. include code signing section to another file which not commit to SVN?
As long as you have just one signing identity, you can just use "iPhone Developer" as your codesigning identity. Codesign will search for an identity containing "iPhone Developer" and use that.
You can base a project or target configuration on the contents of an xcconfig file that is not checked in to Subversion or is otherwise customized per developer. Add an appropriate xcconfig file to your project and then choose the file from the "Based On" pop-up at the bottom of the Build tab in the Project Info or Target Info window.
For example, you could have a DeveloperSettings.xcconfig file in the project whose contents on your system are:
CODE_SIGN_IDENTITY = "iPhone Developer: favoyang"
while its contents on my system are:
CODE_SIGN_IDENTITY = "iPhone Developer: cmh"
These settings will be inherited by either the project or target configuration that is set to be based on this file.
You can use $(USER) in your build setting definition to include your short user name.
For example:
CODE_SIGN_IDENTITY = "iPhone Developer: $(USER)";
That will use the contents of the USER environment variable in the definition of the CODE_SIGN_IDENTITY build setting.
The obvious choice would be to create other build configurations.
Why are you "changing this line" directly? You should almost never directly edit anything in the .xcodeproj file bundle.
Instead, you should be changing this within your build settings. To be more specific in your case, you need to add several more build configurations, one for each member of the team. That member can then build using their own provisioning file withouth messing with any other build settings.