Developer ID Code Signing working on one machine but not another - ios

I have a Mac Pro that I usually build and sign my apps on for distribution outside of the Mac App Store (signing is required for Mountain Lion machines that have Gatekeeper even if it isn't an app store app).
I sign the applications in Terminal, and it works fine on the Mac Pro, so I went to create another Developer ID Application certificate for a Mac Book Air, successfully created an installed the certificate, but I'm completely unable to sign any apps on the air still. I keep getting the error:
object file format unrecognized, invalid, or unsuitable
The problem is that I can take the built .app file that was built on either machine and successfully sign it on the Mac Pro. If I take a .app file built from either machine and try to build in on the Mac Book Air I receive this error. I'm not getting any errors about the certificate.
Just so it's here, I use the following two lines to sign the app (which I copy to an "App" folder on my desktop):
cd ~/Desktop/App
codesign -f -v -s 'Developer ID Application: [company name]' '[appname].app'
I've checked in Keychain access and the certificates show up nearly identically on both machines. Both computers are running 10.8.3. I can't really see what the difference is that is preventing the MBA from signing the app.
Thanks for any help!

The Mac Book Air did not have extra Command Line Tools installed, which is what caused the problem. I needed to have Xcode 4.4 (or newer) and go to the Preferences Window > Downloads section and install the Command Line Tools from there for the code signing to work properly.

Related

Xamarin cannot build to device - Tool exited with code: 1. Output: error: The specified item could not be found in the keychain

I am trying to build an iOS app in Debug|iPhone configuration on Xamarin Mac, but I am getting:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets: Error: Tool exited with code: 1. Output: error: The specified item could not be found in the keychain.
This all started when I had to reset my default keychain and lost my certificates. I've tried fixing it by:
Creating a new certificate manually (ensuring I had "Apple Worldwide Developer Relations Certification Authority" when requesting the certificate from the certificate authority as suggested here)
Creating a certificate using xcode 8.3.1 (exporting this certificate onto another machine lets me build fine on that machine)
Importing my certificates from my old keychain (each time I created a new certificate I ensured to update and download the provisioning profile)
exporting a working certificate from another user on another machine and importing it onto my machine
uninstalling Xamarin studio, deleting the folders mentioned here, and installing Xamarin Studio 6.1.3 + Xamarin.iOS 10.4.0.123 (was using 6.1.3 + 10.2.1.5 previously)
uninstalling Xcode 8.1 and installing Xcode 8.3.1
installing visual studio for mac (this gave me a different error "EnsureBindingRedirects task failed unexpectedly" - likely a separate bug)
The fact it failed to build when using a known working certificate/provisioning profile combo on another machine leads me to think that Xamarin is having a problem finding the certificate when doing the build, even though it sees the certificate and provisioning profile in Project Options -> iOS Bundle Signing. There could also be an issue in the Keychain somewhere.
Any help on this would be greatly appreciated.
I fixed this by doing the following:
security dump-keychain -d login.keychain to list all the items in my keychain
Noticed there was an extra certificate that was not showing up in Keychain Access
Deleted this item using security delete-identity
Did diskutil resetUserPermissions / $(id -u) and restarted my Mac
I'm not sure if steps 1-3 are necessary, so if you are having this issue I would try step 4 first and see if that works.
I am using Visual Studio on a mac and my solution was to shut down Visual Studio and start it again after logging out of Apple Developer Account in the visual studio preferences.

ad hoc install iphone app using Ubuntu

The single way, as I understand, can be drag&drop .ipa file to iTunes app on laptop while iphone is connected. I tried to install iTunes on Ubuntu, but as there is no linux version, I try with wine/playonlinux. In playonlinux I tried different versions of iTunes from official website. For version 11.1.5 32 bit it says that iTunes Library.itl file was created by previous version of iTunes. Have no idea where to look for this file in Ubuntu or simply download the old lib file... For version 64bit playonlinux says that installation crashed with POL_ error. Trying to install additional POL modules while creating a virtual space failed. Trying to use wine ./iTunes64Setup.exe crashes because my wine wasn't built with 64bit apps support. I tried to ./configure --enable-win64 to install wine64 from sources, but got error like YYLEX is undefined. Following suggestions in another stackoverflow post here it still fails on make depend && make even after installing flex and bison packages and make distclean.
Now, the question is what is the best way to install .ipa app on my iphone using ad-hoc method without itunes or how to install itunes on Ubuntu 14.04 so that it's possible?.
There is also suggestion to try libimobiledevice4, but I don't get it how can I just copy-paste an app.
IF you want to install .ipa app on your iPhone without iTunes you may want to take a look at TestFlightApp. You can upload your adhoc apps to there and then install in on your device directly from the device without iTunes or Xcode.

Signing Issues for Cydia

I am trying my best to update an app for Cydia that is constantly crashing on startup. It has a base SDK of 7.0 with a deployment target of 6.0. I have Xcode set to not require code signing. I have tried this many different ways, and each way, it crashes on startup when I download from Cydia.
First, I tried not code signing and using ldid on my Mac to psuedo-sign it. I copied the .app file to my desktop and then did:
Open Terminal on the OSX system where the application was built.
Add the SHA1 hashes to the application binary:
# cd ~/Desktop/
# ldid -S HelloWorld.app/HelloWorld
I tested this out by copying it to my iPhone, and it worked fine. I then uploaded the .app file to thebigboss repository, and when it went live I downloaded it, but it crashed on startup.
My next attempt was to simply create a certificate in Keychain Access. I left it as a self-signed root and changed it to code-signing. I put in a unique serial, and left valid days at 365. I then tried using it in Xcode but Xcode gave me an error that it was no longer valid and I needed to check the expiration date of my certificate.
I really need help with this, as I cannot figure out for the life of me what is going wrong here, and customers on Cydia are getting upset.

Can I sign the iOS app with an AdHoc profile wihtout using XCode?

Preferably using Linux, Windows is also OK.
Something like openssh and zip?
If you can remotely shell into the Mac (ssh), then you should be able to build and sign your project from the command line. It may require some setup beforehand, but xcodebuild and xcrun should get you where you need to go. (This is the same kind of thing folks do to get automated continuous integration builds set up.)
Doesn't get you out of using Xcode or a Mac, but maybe gets you out of having to be physically sitting in front of that Mac to get work done.
Further reading:
Xcode “Build and Archive” from command line
xcodebuild man page
xcrun man page
I would use TeamViewer ( payed version) or other remote desktop software to connect tom office mac mini. Otherwise you will break up the signing license too, beside it is hard to configure the keychain.
It will be very hard to figure out after you have signed a build why it doesn't install at client's PC, because no error messages there.

"Unable to download application. <Appname> could not be installed at this time"

I'm almost dead now. I've been trying for about 2-3 weeks to fix that problem, but still no result. Hope anyone is able to help me:
I'm writing iOS Apps with Titanium Studio. Until Mac OS X 10.6.8 with Xcode 4.2 everything worked just fine. I was perfectly able to build apps in Xcode und deploy them In-House in our Enterprise. Now I've upgraded to OS X 10.8.2 with Xcode 4.5 and there we go...
Apps can still be built and are runnable on the iOS Simulator, but if I try now to get the app on some devices, I get a message "Unable to download application. -Appname- could not be installed at this time". This happens either through OTA distribution and through iTunes with an USB Cable.
I've searched almost the entire internet, but all I've found didn't work at all.
But if I actually try to deploy the application through Xcode it works though.
Does it have something to do with those Profiles and certificates? I've already tried to revoke them and so on, but nothing helped. I also installed OS X completely new, so that I have a clean keychain. Same result.
Would really really appreciate any kind of help. Thanks!
Finally i found a solution, when i tried to sign the App manually, the console threw an Error message that helped me to fix it again.
The Problem started when i upgraded to Mountain Lion and had to update xCode to 4.5.2
Maybe it helps others who still couldn't find a solution after several days of searching the internet
Unzip the Ipa
unzip Application.ipa
delete _CodeSignature
rm -r "Payload/Application.app/_CodeSignature" "Payload/Application.app/CodeResources" 2> /dev/null | true
if there isn't the right provisioning profile, replace it
cp "ProvisioningProfile.mobileprovision" "Payload/Application.app/embedded.mobileprovision"
The problem for me was this error when i tried to resign the app manually:
"object file format unrecognized, invalid, or unsuitable"
fix it :
export CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/usr/bin/codesign_allocate"
resign the app
/usr/bin/codesign -f -s "iPhone Distribution: Company Name" --resource-rules "Payload/Application.app/ResourceRules.plist" "Payload/Application.app"
Zip it
zip -qr "Application.resigned.ipa" Payload
Thanks to
This Question on how to sign an app manually,
the console which got me the error
This Post which helped me to fix the error
Apple which makes our lives too hard
Update
It seems the location for codesigning has changed. The new path would be
export CODESIGN_ALLOCATE="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate"
As taken from this answer
I had the same “Unable to download application. 'Appname' could not be installed at this time” message, and spent several weeks checking and renewing the certificates, rebuilding, re-doing the OTA distribution, etcetera. It turned out that I simply hadn't added the .mobileprovision files to the project. Just in case this helps anyone…

Resources