How can I diagnose an Xcode Code Signing failure? - xcode

With Xcode 10.2 I'm getting a Code Signing failure of
resource fork, Finder information, or similar detritus not allowed
Command CodeSign failed with a nonzero exit code
but I don't how to find which particular element of the massive project is causing the problem.
This, by the way, was not occurring with Xcode 10.1. Back then I did find that some of my .png images contained color profiles which were removed and stopped a code signing failure there.
The current failure occurred after bringing the code unchanged from under 10.1 where no failure happens. And it does not happen either when I take the code as modified under 10.2 back to 10.1. So this is making me crazy!
Now, I can't even find Apple documentation to help me find what to fix! Any suggestions will be gratefully processed. Thanks.

I examined (again) the dense paragraph above the code signing error message. The main thing it contained was a path to my app bundle. So I thought something extraneous might be within the bundle.
I went to the Products folder in the project navigator panel in Xcode and right-clicked my app, then selected Show in Finder, then in the Finder I right-clicked the app and selected Show Package Contents, then expanded the Contents directory and then the Resources directory which is the most likely place to find detritus.
Sure enough, there was a .png image file which I had rejected for use while experimenting with the app. I had commented out // the code lines referring to it, but had not deleted that image file from among the Supporting Files in the Xcode navigation panel.
I did delete it and re-built the app. Voila, no more code signing fault!
Thanks, guys, for your kind attention to this question, and all the questions people ask.

Related

How do I find why Xcode no longer notarizes my app?

I have a MacOS app that I last notarized about a year ago with no issues. This time, however, when I created the initial Archive, the Organizer put it into a section called 'Other Items' instead of in the 'macOS Apps' section with all of the previous Archives. In addition, and more distressingly, when the Archive is selected, the button says 'Distribute Content' instead of the expected 'Distribute App', and pressing it simple exports the Archive or its contents, without running through the automatic notarizing process.
I suspect I have done something in the last year that somehow invalidates my app such that Xcode no longer recognizes that it is an app. I have followed the suggestions at https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution/resolving_common_notarization_issues, but that did not provide any relevant clues.
I am using Xcode Version 13.4.1. How do I figure out what is preventing Xcode from offering to notarize the app?
To track this down, I created a new project, and then tried to notarize it. (I didn't actually notarize it, I just made sure that I could Archive it and it showed up in the correct section in the Organizer.) The new project archived as expected, so I knew that I could still notarize somethings; I was just having an issue with my app.
My plan was to copy items from my app into the new project in small chunks, and after each copy, attempt to Archive it. I figured that I would either find the item that was causing the failure (and fix it), or I would eventually copy the entire app without a failure. Either way, I would be able to notarize the app.
The first chunk I copied was all of the build settings. And right there, the new project would not notarize, so I removed and added build settings to binary search which setting was causing the failure. It came down to the RUN_DOCUMENTATION_COMPILER = YES build setting.
In the last year I have been more conscientious about documenting the code, and to actually see that documentation, I had added that build setting.
Comparing the archives created with and without running the documentation compiler, the MyApp.doccarchive file appears in the archive in the Application folder along side MyApp.app, so it appears that Xcode is confused by the "extra" file in the Application folder.

Xcode project crashes after .png file is added

I am building a simple Swift based project in Xcode 9.2. I would like to import a .png image file into my project, to display within my app. I attempt to do this by dragging a .png file into the Xcode Navigator. A dialog box appears, asking me to "Choose options for adding these files:". I select the "Copy items if needed" box, I select the "Create groups" radio button, and then I press "Finish".
The .png file now appears in my project, however my project no longer builds. Instead of "Build Succeeded", I get "Build Failed". The only change is adding the .png file.
The "Build Failed" message says that I have a "Code Sign Error". Clicking on this message, I get the following additional detail:
Debug/FourBarVisualizer.app: resource fork, Finder information, or similar detritus not allowed
Command /usr/bin/codesign failed with exit code 1
Deleting the .png file fixes the problem.
Adding .txt files or .jpg files the same way doesn't cause any problems.
Any help or insight would be greatly appreciated. I'd prefer not to have to convert all my .png files to .jpg. Am I doing something wrong, or is this an Xcode bug? Thanks.
I can't be certain this applies in your case, but I just suffered the identical problem and was all ready to blame the recent Xcode 9.3 update, but StackOverflow suggested your question as being similar to the one I was in the process of writing.
I was just about to use ImageMagick to convert the PNG to another PNG in the hope of removing whatever upsets Xcode and I noticed that it had the hide extension attribute set. Unchecking that (before adding to the project) fixes things for me.
Having discovered that, I can now see what the additional text in the error was getting at ("resource fork, Finder information, or similar detritus not allowed"), even if it wasn't quite enough to guide me immediately to the solution.

Storyboard Internal Inconsistencies

I have a similar situation explain on this thread (XCode 5 Storyboard Internal Inconsistencies), but I installed the final version of the Xcode and never installed any beta version. Additionally, I can't add comments in previous thread cause I don't have enough points. So i need to ask my specific case.
In XCode 5, I have a problem with all of my projects "The document 'main.storyboard' has X internal inconsistencies that were found and repaired. Please save this document to fix the inconsistencies."
If you choose to list the inconsistencies, you see that it's saying that some Images in my resources section, that uses this image, and is duplicating in the Storyboard. I try to save the document, but it does nothing, and when I relaunch the project, I get the same error.
I try all this things with NO SUCCESS:
I delete all duplicates in storyboardFile file.
Drop the image file from my project and add again.
Reconnect UIButtons with the problem image.
Change the image name file.
In my research, also I create a new project in XCode 5, add a same image in two objects inside Storyboard and got the same message.
Anyone have the similar problem?, and more important, anyone have a solution?
I have XCode 5 and OSX 10.8.5.
**** UPDATE *****
I found a workaround. The error is generated when one image inside the storyboard is used several times, if you delete the reference of the image and assign the image to the object by code, the error disappears, but I don't like it. I'll research a little more, but apparently is a bug from Xcode (I hope not).
This problem occurred for me Xcode 10.1 but was resolved. The error message provided a "Show Details" button.
Clicking on Show Details showed my problem, a duplicate.
Right-clicked on the identified storyboard (Main.storyboard) to open as source code.
Searched for the duplicate declarations and removed one of the duplicates.
The error message no longer occurs including when the storyboard is reopened.
An easy way to fix this problem is to open up the Storyboard in TextEdit, then go down to the resources section at the end and delete any duplicate entries for images you see. They're sorted alphabetically, so it's fairly simple to do.
Saved the file, loaded up XCode and no more error messages.
I upgraded to Xcode 5 last night and am experiencing multiple issues, including the one you described above. I also seem to have found a workaround, albeit different from the one you found.
To get rid of it I saved the project, closed it, opened a different project and ran it in the simulator, quit Xcode then reloaded the original project.
Error message no longer appeared.
I have no idea why but this seems to have solved it for me.
Now to tackle the other niggles......... :-/
Same error today after upgrading to Xcode 5: internal inconsistencies relating to images that are used more than once in storyboard, but I found a solution that worked for me here: https://devforums.apple.com/message/883402#883402.
I created a new Asset Catalog (New file / choose "Resource" / Asset Catalog).
Once created, I selected the option 'Import from project' and imported all my images. Seems to have done the trick.
After installing Mavericks and Xcode 5.0.1 the problem was fixed.
Try to find under inferredMetricsTieBreakers section at the end of the storyboard unused segue references in the whole document as in the photo

Xcode 4 shows no files after loading project

I've loaded a project in Xcode 4 after not looking at it for a while. Xcode shows its progress bar and indicates in text that the project is loading, and it appears to finish, but then there are no files shown in the hierarchy or flat views. There is nothing showing in any view (except for one breakpoint in the breakpoints view).
Any ideas? Xcode gives me zero indication that anything is wrong, it shows me nothing.
I just had the same issue. After a few hours scratching my head and trying all kind of things, I finally found a fix: remove the whole package 'project.xcworkspace' inside the XXXXX.xcodeproj package.
More specifically, when you find the 'XXXXX.xcodeproj' file, right-click it, and select 'Show Package Contents'. This will get you inside the package where you will find the 'package.xcworkspace' file. It is best to do this while the Xcode project is closed.
Maybe that will work for you or for others with the same issue in the future...
Some of the project views have the "Recently Changed" filter icon. For me the problem was: i had that enabled in the Project Navigator, so it was only showing the files i recently changed. It looks like this.
I'm using Xcode 6.1 though.
I had a similar issue. After archiving a project the files would disappear from the project navigator.
It turned out that somehow XCode had added the word "main" to the searchbar below the project navigator so that almost all files where invisible. Quite frustrating.
It might be the same case for you..
For those who make it here, I was opening a older version of a similar iOS project after upgrading to the latest XCode (6.2), and was seeing the symptoms labeled in this question (missing files, folders etc.)
My solution: at the bottom left of the screen, unselecting 'Show only files with source-control status" which happened to be set on (it's blue when on). The icon looks like a 4-pt star inside a square.
remove the whole package 'project.xcworkspace' inside the XXXXX.xcodeproj package. may cause to any other error so please ignore and trying finally
You can quit xcode and reload again your project it help you
This happened to me when I tried to do an alt-tab, on a VM running in TeamViewer in Windows - Click the search bar below, enter delete multiple times and the invisible search term cleared up
I had the same issue. Besides the answers above, it could also be that you have already accidentally opened the project in another Xcode window... Close that and reopen everything and it should work.

Xcode 4 code sense is not working

I am running a "old" Xcode 3 project in Xcode 4 and code sense is not working for my own classes. I have tried following:
Clean/rebuild
Remove Derived Data
Installing 4.3 documentation
Restart
Without any luck.
Sometimes the code sense works but mostly I just get "No Completions".
Try this:
Open Organizer then Project Tab.
Clear the "Derived Data". Xcode should re-index your project then and code sense should work. At least worked for me.
I know this is late, but for reference: http://sealedabstract.com/code/when-xcode-4s-code-completion-autocomplete-breaks/
Close the project, leaving XCode still running.
Open XCode’s Organizer window, go to the Projects Tab, select the correct project, and hit the Delete button next to “Derived Data”.
Quit XCode.
Navigate to your project’s .xcodeproject file in Finder. Right-click, choose “Show Package Contents.”
Leave the project.pbxproj file, but delete the project.xcworkspace file, any .pbxuser files, and the entire userdata folder.
Open the project in XCode. You will see XCode riding high on the CPU usage for around 10-60 seconds, depending on the size of your project. The activity window will say “Indexing”
When your CPU spike returns to earth, code completion will be working again.
There's a lot of deleting going on there so please be careful, but this definitely worked for me.
I've been doing this, and it's worked multiple times for me (after trying all of the above previously).
Edit: Now I just hit space, backspace (the mac version) and rebuild... works nice. Then, remember to scroll (sometimes the colors don't show up until you scroll somewhere)
Find your prefix file: "ProjectName_prefix.pch".
Comment out some line. (basically change it)
Build your project, doesn't matter if it fails or not.
Uncomment it.
Build again.
I'm betting only step 2 (modify the prefix) is what does it, but these essentially get you back to running. Suddenly everything magically recolors itself and completes functions.
Good luck if that doesn't fix it, perhaps try doing this to your dependency pch files (three20 or FB api's)
Clearing the "Derived Data" only works temporarily for me. I have to do it and then restart Xcode like 3-4 times each day to get code sense working again.
I found out the real cause is in the Target's Build Settings. I moved everything from Header Search Paths to User Header Search Paths and it is fixed. In my case, the framework I'm working with is RestKit.
BTW, I came up with this because I was adding another project (QuickDialog) into my project and I was curious that it is using User Header Search Paths, but not Header Search Paths. Here is the difference between them.
You can able to fix that issue by change build settings like this, PreCompile Prefix Headers :NO
FYI, if one file doesn't have code sense but the rest of your project does, check that its added to a target. Once I did that I got code sense back in that file.
It's been ages but the answer is just to move the code into a new folder and the code sense should be working now.
This happened when I added a new Objective-C Class and the code sense doesn't work only on the newly added .m and .h files (on XCode 4 latest update during this post).
Close all xcode windows
Delete all your projects from xcode>window>organizer and restart your project. It will now sense and index your project properly.
I wrote about it in detail here.
Basically my fix was that with localization. I upgraded from xcode 3.2.5 to xcode 4 and then screwed around with built in interface builder and turned on localization for a XIB file accidently which placed my source files in en.lproj directory. After moving them back to Classes folder it worked perfectly.
Again, for the sake of helping others with this issue which, in my case, happened upon upgrading to Xcode 4.3.
Of course I tried the solutions offered in this post, and none of them worked. But the suggestion to move the location of the project in Finder brought back some Code Sense, but the suggestions didn't make any sense.
I ended up deleting my project and re-cloned it from the git repository.That brougt back Code Sense for me...
I open a second project in the background whenever my Xcode's code sensing stops working (it usually works the first time i open the project but after a while code sense no longer works). So what i do is to open a second project in Xcode. Xcode will start indexing the second project and magically the code sense for my main project is back.
Running Xcode 4.3.1 on Lion
Hope this helps someone.
From this comment here I was able to debug the problem on my end, it seemed to be a bad -w flag that the clang preprocessor wasn't recognizing properly. Basically, running
defaults write com.apple.dt.Xcode IDEIndexingClangInvocationLogLevel 3
in Terminal increases the verbosity of the indexer, and should help you track down issues. Open Console.app and look for messages from Xcode, the search string IDEIndexingClangInvocation helped me find them.
For me it happened simply because the file had no target membership. If the first few answers did not work for you, go to your .m file (presumably it's this file that you're having trouble with), open the Utilities view (Edit -> Utilities -> Show File Inspector) and under "Target Membership" check the target to which you want this file to belong.

Resources