Signing Issues for Cydia - ios

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.

Related

Resigned IPA is not verified correctly by codesign

I have an IPA file exported for development and I want to sign the IPA file using a valid enterprise certificate. Actually, I have gone through all the steps mentioned here amd here and used various available tools such as ota-tools and iResign to sign the file.
The app is actually a very small swift app and only uses app groups and key-chain sharing capabilities and is developed by members of my enterprise team using the App ID and team identifier that we have defined using Xcode in our enterprise account.
I have done the resigning process without any problem and the app is installed successfully on my iPhone. But it immediately crashes upon startup.
So, I doubted the resigning process and did some checks. I tried to check the resigned IPA file using 'codesign -v' command but it says "code object is not signed at all".
I also unzipped the IPA file did all the code-signing on the main app and Frameworks folder but still head no luck with codesign verification. it still says "code object is not signed at all".
I would appreciate if someone can help me with this problem.
I'm having the same problem where the app won't start after resigning and installing. Did you have any success resolving this problem?
About the codesign verification, if you've successfully installed the app on the phone that means that the resign is OK. Also you should run the 'codesign -v' command on the .app itself in the ipa file, because that's the file you're actually signing, the ipa is just a zip you create after the resigning.
I had the same problem (resigned app crashed on launch). I figured out that this happens only for IPAs with embedded bitcode.
Removing bitcode support from project settings (ENABLE_BITCODE = NO) fixes the problem.
I understand that this is limitation, for this reason I opened an issue on fastlane sigh (the main tool I use for resigning) on Github.

If I moved my Xcode project folder to another computer running OS X, Can the app still be built and run there?

I have an Xcode project that needs to be copied to another Mac. Because I don't have another Mac, I can't try it to see what happens.
If the user opens the .xcodeproj file and build it. Will the build succeed? And if he/she opens the project and click on the run button on the top-left corner, will the app run on a simulator?
I am asking this because in project settings, I set the Team to myself, I'm afraid that the app won't run because of this. Because I think when you run the app, it finds the certificates from the keychain. If a valid certificate is found, the app will run. But in someone else's Mac, the keychain does not contain the required certificate. So I think the app might not run successfully.
Will the project run on other Macs if they don't have the certificates? Do I need to do additional things to make this work?
Yes, As long as you aren't trying to run it on a physical device and only the simulator it will work.
If you are trying to install and run it on a physical device you will need to be able to link your username/certificate type thing in the build settings in Xcode

Phonegap local builds fail with media plugin

create new project
build for iOS: SUCCESS
add media plugin
build for iOS: FAIL
The following build commands failed:
CompileC build/HelloWorld.build/Debug-iphonesimulator/HelloWorld.build/Objects-normal/i386/CDVSound.o HelloWorld/Plugins/org.apache.cordova.media/CDVSound.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
[error] /Projects/Code/hello/platforms/ios/cordova/build: Command failed with exit code 65
Here's the list of commands
phonegap create hello
cd hello
phonegap build ios # WORKS
phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-media.git
phonegap build ios # FAILS
Same scenario happens with cordova, and if I use sudo.
I fixed the problem by completely deleting the iOS folder under platforms, then re-running phonegap build ios.
This is something I ran into a while back. If you’re not an iOS developer, but get tasked with building iOS apps, you may run into this. This particular exit code is fun because xcodebuild doesn’t tell you what the problem is.
Aside from building your app using the Xcode IDE, you also have the command line utility xcodebuild available to you. Assuming the code itself compiles just fine, this tool will tell you, for example, if you’re missing a provisioning profile or something.
In my case, it turned out xcodebuild didn’t have access to the certificate I was using.
So… here’s some things to check for:
Make sure you’ve installed an up to date certificate in your Keychain
Remove expired certificates
Grant access to xcode to use your certificate (or allow all programs to use the certificate)
Make sure you’ve installed an up to date provisioning profile
Remove expired
provisioning profiles
Another option ....
use https://build.phonegap.com which will build the app for you and generate your .ipa and .apk files. It is free for 1 project (just delete your project and then re-upload if you have multiple ones). Just make an account, upload your certs and then you upload your www folder.
Thumbs up if you this was helpful to you!
I got the solution on PhoneGap Google group
And the solution is to add the File plugin also. Strange that these dependencies are not mentioned but it worked. I guess we'll need to randomly try the combinations of plugins until something works.
The bug is logged here: https://issues.apache.org/jira/browse/CB-6225
And it looks like you have to add File plugin first, then Media, the order is important.
try add sudo when add cordova plugin into your project.
sudo cordova plugin add https://github.com/apache/cordova-plugin-media
I was getting an exit code 65 after adding the dialogs plugin. Tried some of the top answers here, but in the end James's advice worked: deleted the ios platform, reinstalled the platform, and then it built.

Developer ID Code Signing working on one machine but not another

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.

"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