Adithya
Adithya

Reputation: 4705

Code sign error : bundle format unrecognized, invalid, or unsuitable

Im working on an iOS app, Swift language, iOS8, Xcode 6.1. It was running fine on the iPad. Then I added a "Resource" folder reference to the project, after which I am getting the Code sign error.

The Resource folder contains some HTML files. I am not sure how this folder reference is causing this problem. Any help please?

enter image description here

Upvotes: 68

Views: 67055

Answers (17)

Jérôme Beau
Jérôme Beau

Reputation: 11450

Had the problem on an app targeting MacOS (not iOS) using AppCode, but I believe that solution should work for all cases: In AppCode, just do a Run > Clean before you build.

Upvotes: 0

electromaggot
electromaggot

Reputation: 675

I know it's an old thread, but I just encountered this issue and none of the other answers helped. For me, this error occurred upon "Embed & Sign" of an old third-party framework, which I don't own. Looking inside that .framework bundle, it did indeed have an incorrect directory format: the Versions/A/ directory was instead named Versions/1.0.0/ (the "1.0.0" of course being an arbitrary version number), which seems to confuse the CodeSign command. So I did cd Versions into the framework's directory, then mv 1.0.0 A and ln -sf A Current - after which the CodeSign and build succeeded.

Upvotes: 2

Tim
Tim

Reputation: 413

I had the same problem, and after unsuccessfully trying practically all solutions reported here, I found that simply deleting the product file (i.e. moving it to the trash in Finder) solved the problem for me.

Upvotes: 0

Omar
Omar

Reputation: 85

solved here

  • make sure all frameworks used added to Embed Frameworks section in in build phases
  • keep copy only when installing CHECKED on same section

good luck

Upvotes: 1

JP Illanes
JP Illanes

Reputation: 3675

Just in case someone else is having this issue: Make sure you didn't add a Static Framework into the "Embedded Binaries" section, only Dynamic Frameworks are required to be there.

Upvotes: 16

Shanmugaraja G
Shanmugaraja G

Reputation: 2778

I have the same issue for some hours. But the following helped me.

  1. Delete Derived data
  2. Clean the project

Then running again, worked.

Upvotes: 34

Zain Ullah Muhammad
Zain Ullah Muhammad

Reputation: 519

for me the problem was, in the info.plist, i forgot to update the url scheme to new bundle id

previous : com.test.app new : com.test.app1

this fixed the problem

Upvotes: 1

igraczech
igraczech

Reputation: 2447

I had similar issue now and it has been actually caused by Fabric's Embed script and resolved by removing a space inside path to project file.

Having a perfectly buildable workspace in project folder called 'app-ios' I have made a copy named 'app-ios 2' and it was not possible to build that. codesign did report bundle format unrecognized, invalid, or unsuitable and respective path was not to the bundle, but ended with /app-ios instead of app-ios 2/DerivedData/...

After renaming the folder to app-ios-2 the workspace is buildable again.

Upvotes: 0

Vincent
Vincent

Reputation: 1386

For someone who like me, all the above solution can't work. You can double check your scheme name, there shouldn't be any space in there. Cocoapods can't handle scheme name with space with version 1.1.1. But I'm not sure why this happen only when I upgrade to Xcode 8.2. It worked pretty fine with Xcode 8.1.

It took me hours to figure out the issue. You can follow this thread

Hope this help.

Upvotes: 0

Elisabeth Dodd
Elisabeth Dodd

Reputation: 1

Experienced this issue after updating to Xcode 8.1. Simply updating cocoapods (by running 'sudo gem update cocoapods' in Terminal) fixed this issue for me

Upvotes: 0

TonyTony
TonyTony

Reputation: 1404

for me, after I upgraded my xcode to 8.1, similar problems occur. I have tried different ways, but seems update cocoapods to the lastest version is definitely worth to do at first. And then update pods with pod install --verbose --no-repo-update and pod update --verbose --no-repo-update would help.

Upvotes: 0

Scriptable
Scriptable

Reputation: 19750

I have had this issue in two different projects, I done alot of the suggested stuff, cleared the DerivedData folder, re-installed pods etc.

In both projects it was complaining about a particular Pod and being unable to codesign it.

What fixed it for me was:

  1. Select the Pods Project
  2. In the main editor window, select the Pod in the targets dropdown
  3. Under the general tab, and under the identity header, click choose Info.plist file
  4. Select the plist file for the Pod

The project should now build. For some reason it seems to lose this setting, or not be able to reference it's own plist file.

This worked for me in both projects. Not 100% sure why, but I hope it helps someone else having the same issue.

Upvotes: 62

Kuldeep Kumar
Kuldeep Kumar

Reputation: 41

Happened with me after a week of updating to Xcode 8.1, turns out I had to update cocoapods (sudo gem update cocoapods) and do pod install again to get it working.

Upvotes: 4

Vaiden
Vaiden

Reputation: 16122

Problem started after upgrading to Xcode 8.1. My project utilizes CocoaPods. I had to delete the ./Pods dir and run pod install and pod update (which updated Flurry-iOS-SDK to 7.8.1). Why? Because reasons.

Upvotes: 0

Adithya
Adithya

Reputation: 4705

OK, solved it, This answer helped me.

I renamed the folder. Apparently Xcode does not like "Resources" file to be created manually.

Upvotes: 97

Avtar Guleria
Avtar Guleria

Reputation: 2136

Addition to accepted answer I thought I should add this-

For me I am getting this error because Xcode-8 is actually using Test Target while running app on device. So if its the same then follow these steps:

Go to Edit Scheme in xcode -> In Build Target -> Remove MyProject.xctest completely or uncheck all the boxes of MyProject.xctest Analyze , Test etc..

Clean your project and then Run on the device.

PS: Answer is from this Link

Upvotes: 1

William Entriken
William Entriken

Reputation: 39283

Clean Build Folder fixed this for me.

Upvotes: 10

Related Questions