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!