Application failed codesign verification in application loader - iphone

I am using xcode 4.2 Build 4C151a. And I failed to submit my app through organizer because this.
But app loader doesn't work either. It just gives a error:
Application failed codesign verification. The signature was invalid, or it was not signed with an iPhone Distribution Certificate.
I check build setting of Project and Targets. The code signing identity of release is iphone distribution.
In Product > Edit Scheme , build configuration has already been change to release.
Xcode gives no error or warning when building and achieving.
After google this error and read the documents of Apple, I use codesign cmd to check my app,
but find nothing wrong:
$ codesign -dvvv /Users/apple/Library/Developer/Xcode/DerivedData/AttentionDetector-gmmelanobmbjlbhahwbarnsctfdk/Build/Products/Release-iphoneos/AttentionDetector.app
Executable=/Users/apple/Library/Developer/Xcode/DerivedData/AttentionDetector-gmmelanobmbjlbhahwbarnsctfdk/Build/Products/Release-iphoneos/AttentionDetector.app/AttentionDetector
Identifier=com.MyCom.MyName.AttentionDetector
Format=bundle with Mach-O thin (armv7)
CodeDirectory v=20100 size=8122 flags=0x0(none) hashes=397+5 location=embedded
CDHash=727f1bb04fb535821626ce50b1a35bc2c638223a
Signature size=4315
Authority=iPhone Distribution: My Name
Authority=Apple Worldwide Developer Relations Certification Authority
Authority=Apple Root CA
Signed Time=2013-5-6 下午02:43:10
Info.plist entries=28
Sealed Resources rules=3 files=18
Internal requirements count=1 size=148
Then I check the zip file, and find something confusing:
$ codesign -dvvv /Users/apple/Library/Developer/Xcode/DerivedData/AttentionDetector-gmmelanobmbjlbhahwbarnsctfdk/Build/Products/Release-iphoneos/AttentionDetector.zip
/Users/apple/Library/Developer/Xcode/DerivedData/AttentionDetector-gmmelanobmbjlbhahwbarnsctfdk/Build/Products/Release-iphoneos/AttentionDetector.zip: code object is not signed
I am not sure if this matters.
BTW my macbook is 32-bits, but my app is build for iOS 6.1 ( may require 64-bits?).
I just copy the SDK of Xcode 4.6 into my Xcode 4.2. The app works well when debuging in my iPad (iOS 6.1.2).
Thanks for your answer.
EDIT1:
Thanks to #Rushabh. I check the entitlements, which I haven't modified, with
security cms -D -i MyApp.app/embedded.mobileprovision
, getting 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>AppIDName</key>
<string>Attention Detector</string>
<key>ApplicationIdentifierPrefix</key>
<array>
<string>XJJGWB4EW6</string>
</array>
<key>CreationDate</key>
<date>2013-05-04T12:31:30Z</date>
<key>DeveloperCertificates</key>
<array>
<data>
...
</data>
</array>
<key>Entitlements</key>
<dict>
<key>application-identifier</key>
<string>XJJGWB4EW6.com.MyCom.MyName.AttentionDetector</string>
<key>aps-environment</key>
<string>production</string>
<key>get-task-allow</key>
<false/>
<key>keychain-access-groups</key>
<array>
<string>XJJGWB4EW6.*</string>
</array>
</dict>
<key>ExpirationDate</key>
<date>2014-02-25T12:31:30Z</date>
<key>Name</key>
<string>Attention Detector</string>
<key>TeamIdentifier</key>
<array>
<string>XJJGWB4EW6</string>
</array>
<key>TeamName</key>
<string>My Name</string>
<key>TimeToLive</key>
<integer>297</integer>
<key>UUID</key>
<string>F0636A25-B371-4FEF-906B-C2979028F218</string>
<key>Version</key>
<integer>1</integer>
</dict>
</plist>
There are two differences: I get this line but others don't
<key>aps-environment</key>
Besides, I get
Authority=iPhone Distribution: My Name
instead of
Authority=iPhone Distribution: My Name(XXXXXXXX)
In my keychain access, I find two distribution certifications: one is "iPhone distribution: My name" and the other is "iPhone distribution: My name (XXXXXXXXX)". Both are valid, but can I delete the former one? The former one was created when I first apply for Apple developer account.
EDIT2: fix the problem of "MyName(XXXXX)". I delete one of the certificates, download the new provision file. Now I get My name (XXXXXXX), But the error still exist!

Related

Command line create Ad Hoc .ipa issue

Since updating to Xcode 8.3, I've found that XCRun PackageApplication is deprecated and I've been trying to switch over to using xcodebuild exportArchive. I've seem quite a few posts about problems doing this but still haven't managed to get this working myself.
My test call is:
xcodebuild -exportArchive IPA -archivePath test.xcarchive/Products/Applications/test.app -exportPath . -exportOptionsPlist a.plist
My xcarchive seems to be fine as I can package it for Ad Hoc distribution manually in Xcode.
My plist is:
<?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>uploadSymbols</key>
<false/>
<key>uploadBitcode</key>
<false/>
<key>method</key>
<string>ad-hoc</string>
<key>compileBitcode</key>
<false/>
</dict>
</plist>
But I get this error:
error: exportArchive: exportOptionsPlist error for key 'method': expected one of {}, but found
Error Domain=IDEFoundationErrorDomain Code=1 "exportOptionsPlist error for key 'method': expected one of {}, but found " UserInfo={NSLocalizedDescription=exportOptionsPlist error for key 'method': expected one of {}, but found }
I've also been trying to use fast lane gym. With that, I can create a .ipa on the command line but I need to specify a provisioning profile to use as it's not being signed with the correct one for testers.
If you need any more information, please let me know.
Thanks,
Chris.
Your value for the -archivePath param is not correct, please try just to reference the xcarchive. You can also omit the IPA string after -exportArchive, as it has no effect:
xcodebuild -exportArchive -archivePath test.xcarchive -exportPath . -exportOptionsPlist a.plist
The xcarchive contains a Info.plist, which specifies where the app bundle can be located inside the xcarchive, so you don't need to specify this yourself.
See man xcodebuild for details

Error, no entitlements found in bundle " "

Please can someone assist me!
I archived my app, and I get this error:
ERROR ITMS-9000 "Missing code signing entitlements. No entitlements found in bundle "com...."
for executable.
How can I resolve this?
Thank you.
I was having this very problem, due to a recently-introduced automated build script. The script was codesigning the resultant app bundle manually and it turned out I needed to explicitly reference an entitlements file in the codesigning step:
/usr/bin/codesign --force --sign "$CERTIFICATE" --identifier "$BUNDLE_ID" --entitlements Entitlements.plist Payload/${BUNDLE_NAME}.app
The Entitlements.plist file is pretty standard:
<?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>fully-qualified bundleid</string>
<key>keychain-access-groups</key>
<array>
<string>fully-qualified bundleid</string>
</array>
</dict>
</plist>

update version in settings bundle fails iphone

I am trying to write a run script that updates version in Root.plist.
This is the script
version=/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString"
$SRCROOT/AppName/AppName-Info.plist /usr/libexec/PlistBuddy
"$SRCROOT/AppName/Settings.bundle/Root.plist" -c "set
PreferenceSpecifiers:1:DefaultValue $version"
Root.plist in settings bundle is
<?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>PreferenceSpecifiers</key>
<array>
<dict>
<key>Title</key>
<string>About</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>DefaultValue</key>
<string>1.0.24</string>
<key>Key</key>
<string>version_preference</string>
<key>Title</key>
<string>Version</string>
<key>Type</key>
<string>PSTitleValueSpecifier</string>
</dict>
</array>
<key>StringsTable</key>
<string>Root</string>
</dict>
</plist>
I have followed instructions from this answer. The version number updates successfully when I create the .ipa and I can see the new version in itunes. But when I try to upgrade the app, device shows '1 item could not be synced. See iTunes for more information'. However if the older app on phone is deleted and a fresh install is made the app installs successfully and correct version appears in phone settings.I am using xcode 4.5.2
Could anyone please help
The following script works to insert the current subversion revision number into our plist:
G_VERSIONRP="`/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" ${TARGET_BUILD_DIR}/${INFOPLIST_PATH}`"
G_BUILDRP="`svnversion -n`"
G_TITLERP="MyApp v"
/usr/libexec/PlistBuddy -c "Set :PreferenceSpecifiers:0:Title ${G_TITLERP}${G_VERSIONRP} (${G_BUILDRP})" ${TARGET_BUILD_DIR}/${PRODUCT_NAME}.app/Settings.bundle/Root.plist
I tried again a few days later, used the script and did a clean build. Replaced existing copy in iTunes, synched, it worked!! The only step not same as previous attempt was, earlier I had deleted existing copy in iTunes library and dragged in the new one. Not very sure if that was causing the '1 item could not be synced. See iTunes for more information' message but now the correct version does appear in phone settings.

Xcode 4.0 validation error CFBundleVersion

I am trying the Update my iPhone/iPad Application which I had created in Xcode 3.x version.
I have added CFBundleVersion and the other in my Info.plist and I have crossed checked every thing but I am still getting the error which is following below.
This Bundle is Invalid. The Info.plist file is missing the required key: CFBundleVersion (1091)
I am getting it again and again and I have checked the CFBundleVersion which is already in my Info.plist file.
Please help me out
Thanks
Following below is the Info.plist file. I have crossed check it several times
<?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>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleDocumentTypes</key>
<array/>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>icon.png</string>
<key>CFBundleIconFiles</key>
<array>
<string>icon-57.png</string>
<string>icon-72.png</string>
<string>icon-144.png</string>
</array>
<key>CFBundleIdentifier</key>
<string>com.my-irc</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.3.5</string>
<key>CFBundleSignature</key>
<string>coRC</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>Internet Relay Chat Server</string>
<key>CFBundleURLSchemes</key>
<array>
<string>irc</string>
<string>ircs</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.1</string>
<key>CQBuildType</key>
<string>personal</string>
<key>LSMinimumSystemVersion</key>
<string>3.1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>MVChatCoreCTCPVersionReplyInfo</key>
<string>http://colloquy.mobi</string>
<key>UIPrerenderedIcon</key>
<true/>
<key>UIRequiresPersistentWiFi</key>
<true/>
<key>UIStatusBarHidden</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>UTExportedTypeDeclarations</key>
<array/>
<key>UTImportedTypeDeclarations</key>
<array/>
</dict>
</plist>
I had the same problem. I solved it this way. In XCode 4.2 click on the Target. In the summary section, you will see a version and a build number. If you set them both to the same thing, it works. If you just set the version only and ignore the build field you will get the error. This fixed the problem for me.
Sounds like something went wrong in the transition from 3.x to 4.0 A few things to check:
In the Project Target Build Settings make sure that "Info.plist File" is pointing to the right file.
Check that the Version field in the Project Target Summary is the right value
There should actually be two entries (by default) these days: CFBundleVersion and CFBundleShortVersionString though I doubt that's the issue
Make sure you don't have a space before or after "CFBundleVersion"
Else, you should be able to paste your plist here. In Xcode right-click on the plist file and choose Open As > Source Code. That'll give you the raw-xml that you can paste into your question (edit your question to update it).
In my case the CFBundleVersion is composed of the subversion working copy revision number on build. This is done by a script that is found under:
Target -> Build Phases -> Run script
After checking the build log it turns out that the subversion binaries Xcode uses are different from the ones I use on the command line (MacPorts version). The received error is:
svn: The path '.' appears to be part of a Subversion 1.7 or greater /.../
After modification of the line below:
REV=`svnversion -nc | /usr/bin/sed -e 's/^[^:]*://;s/[A-Za-z]//'`
to:
REV=`/opt/local/bin/svnversion -nc | /usr/bin/sed -e 's/^[^:]*://;s/[A-Za-z]//'`
everything works fine again.
I had that problem too. Here is my solution:
Follow the directions Here
Click Product > Clean
Click Window > Organizer
Click Archives
Click Validate

How to regenerate an iPhone Xcode info.plist file

I have moved my iPhone app from one machine to another. In the process my info.plist file seems to have a bad bundle identifier and is not working. I want to create an entirely new info.plist file for my project.
How can I do this?
Here's a clean info.plist for you. Don't forget to replace xxx.yyy, and rename xib file (if required)
<?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>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>Icon.png</string>
<key>CFBundleIdentifier</key>
<string>xxx.yyy.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSMainNibFile</key>
<string>MainWindow</string>
</dict>
</plist>
If you just want an empty info.plist file, then just select "New File..." on the "File" menu in XCode.
In the "New File" window you pick "Other" on the left hand and then "Property List" on the right hand.
I had problem finding "Info.plist" file too, especially that some C++ test application target doesn't have "Info" tab, so modification in this file had to be done manually.
To find it:
Select project in project navigator
Select desired target (project can have multiple targets)
Select tab "build Settings"
Search for entry "Info.plist File". There you should find path of this file
Tested on Xcode 7.3.
In my case I had to "Allow Arbitrary Load" in "App Transport Security Settings" to restore insecure HTTP protocol.