An error occured during export, Codesign failed , XCode 8.2.1 - ios

AnyOne has an idea how to solve this ?
PS : My project Settings are all verified.
Thanks.

Open finder--> press option Go - > Go to Folder
type your project path in that like :
Library/Developer/Xcode/DerivedData/yourprojectname/Build/Products/Debug-iphoneos
Now new window opens with list of Files, There you see yourApp.app file.
Now,
Open Terminal and type just cd then just drag yourApp.app (from finder window) to terminal, now you will get the path for the app, now press enter.
Now type command below:
xattr -rc .
Don't forget "."(Dot) at last.
Press enter button.
Now, Go to your Xcode project and clean and run again.
EDIT:
it is all about path miss match and cached path that you used before. so while doing above steps you are clearing build path for the project, that will make xcode project to run as new without taking cache.
making copy of the project and running same project with xcode make issue or keeping project in icloud and running from that location also makes issue.
May this help.

i just changed codeSign -> Release to iOS distribution then i put it back to iOS developer then i did a simple clean.
And that solved my problem (find it quite strange !!!).

Related

Xcode 10, Command CodeSign failed with a nonzero exit code

Every time I build a console is showing this message.
CodeSign /Users/admin/Desktop/AppStoreBuild/Project201/build/Debug-iphonesimulator/Project.app (in target: Desker)
cd /Users/admin/Desktop/AppStoreBuild/Project201
export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
Signing Identity: "-"
/usr/bin/codesign --force --sign - --entitlements /Users/admin/Desktop/AppStoreBuild/Project201/build/Project.build/Debug-iphonesimulator/Project.build/Project.app.xcent --timestamp=none /Users/admin/Desktop/AppStoreBuild/Project201/build/Debug-iphonesimulator/Project.app
/Users/admin/Desktop/AppStoreBuild/Project201/build/Debug-iphonesimulator/Project.app: resource fork, Finder information, or similar detritus not allowed
Command CodeSign failed with a nonzero exit code
...
Is there any way to identify the cause of this failure? It's showing Signing Identity: "-" when I try to run in the simulator also. why do we need signing identity in simulator? And one more thing is if I quit Xcode and restart, it will build properly when I change code or add a method will again build failing.
I had that problem and Xcode failed to compile on the device, but on simulator, it worked fine.
I solved with these steps:
Open keychain access.
Lock the 'login' keychain.
Unlock it, enter your PC account password.
Clean Project in the product menu.
Build it Again.
And after that everything works fine.
None of the listed solutions worked for me. In another thread it was pointed out that including a folder named "resources" in the project causes this error. After renaming my "resources" folder, the error went away.
For some people this happens after adding a .png file to an existing .scn assets folder, plus also a .wav file.
Xcode, owing to increased security, doesn't like extensions on files. You can fix these one at a time by cd'ing into the directory where the file is and removing their extended file attributes using the 'xattr' command in Terminal.
To Remove All Extended Attributes On a Single File
Use xattr with the -c flag to "clear" the attributes:
xattr -c yourfile.txt
To Remove All Extended Attributes On Many Files
To recursively remove extended attributes on all files in a directory, combine the -c "clear" flag with the -r recursive flag:
xattr -rc /path/to/directory
Fore more detail, see
How do I remove the "extended attributes" on a file in Mac OS X?
This solution will also help when getting the code signing error: "resource fork, Finder information, or similar detritus not allowed."
Apple documentation: https://developer.apple.com/library/archive/qa/qa1940/_index.html
Fix
Remove extended file attributes in your resource files for good, not in the compiled application bundle:
Open Terminal
Change directory to the root of your source files
$ cd /Users/rjobidon/Documents/My\ Project
List all extended attributes
$ xattr -lr .
Remove all extended attributes
$ xattr -cr .
Xcode errors
"Command CodeSign failed with a nonzero exit code"
"Resource fork, Finder information, or similar detritus not allowed"
Cause
Apple introduced a security hardening change, thus code signing no longer allows any file in an app bundle to have an extended attribute containing a resource fork or Finder info.
Sources
https://developer.apple.com/library/archive/qa/qa1940/_index.html
This happened to me just today, only after I added a .png image with 'hide extension' ticked in the get info. (Right click image) Ths image was added to the file directory of my Xcode project.
When unticked box and re-adding the the .png image to directory of Xcode, I then Cleaned and Built and worked fine after that, a very strange bug if you ask me.
Try cleaning the project:
1. shift + cmd + k
2. shift + cmd + Alt + k
Then try to run your project again. Hope this will fix the problem.
None of the popular solutions worked.
In my case, I resolved the error by going into the
XCode -> Preferences -> Accounts -> Manage Certificates
and added a (+) to iOS development.
This issue happened to me after adding .dae and .png files and converting .dae with XCode Editor to SceneKit scene file format (.scn).
After doing some more research I found the solution here - https://forums.developer.apple.com/thread/109951#336225
Steps to solve the issue:
In XCode go to Preferences
Click on Locations tab
In Command Line Tools select from the drop down XCode 10.1
In Xcode: Go to Preferences Logout of the current user.
Close Xcode
In Keychain: Go to Login and All items
- Sort by kind
- remove "Apple Worldwide Developer Relation Certification Authority"
- remove "Developer ID Certification Authority"
- remove "iPhone Developer ...."
Open Xcode
Go to Preferences and Login to you user apple account
This will reload your developer certificates you previous deleted
Rebuild the project (Should be a successful build)
Run the build on your native device
This is because Code signing no longer allows any file in an app bundle to have an extended attribute containing a resource fork or Finder info.
To see which files are causing this error, go to .app folder, normally is like: /Users/XXXX/Library/Developer/Xcode/DerivedData/MyProject-ckbzynxqjmstxigbdwwkcsozlego/Build/Products/Debug-maccatalyst/ (mine is Catalyst project)
In Terminal,
cd <above path>
xattr -lr .
You will see some files has extended attribute:
./MyProject.app/Contents/Resources/shopping_cart.png: com.apple.lastuseddate#PS:
00000000 BE 31 D5 5E 00 00 00 00 D0 40 FE 39 00 00 00 00 |.1.^.....#.9....|
Then go to your project folder or referenced folder for those files, remove extended attribute:
cd /Users/XXXX/Work/MyProject
xattr -cr .
After clean all referenced folders, go to Xcode and rebuild.
The solution for me was restarting macOS without saving
I'm unsure of what causes this issue but one method I used to resolve the porblem successfully was to run pod update on my cocoa pods.
The error (for me anyway) was showing a problem with one of the pods signing. Updating the pods resolved that signing issue.
pod update [PODNAME] //For an individual pod
or
pod update //For all pods.
Hopefully, this will help someone who is having the same "Command CodeSign failed with a nonzero exit code" error.
In my case was the following errors lines:
Signing Identity: "-"
…..mobile.app: resource fork, Finder information, or similar detritus
not allowed
Command CodeSign failed with a nonzero exit code
the problem was that in the resources folder I had some files with .png extension, which was hidden on the defaults.
Find file in FINDER, mark it -> cmd+i -> unchek Hide extension
after that, return in Xcode -> kmd + shift + K and rebuild.
I hope I've been helpful!
For me the solution was the following, having the "Automatically manage sign" flag on:
in the team drop-down of the target, select "None"
re-select the correct development team
After trying almost every suggestion, I found that this works, I guess because Xcode sets up the signing stuff from scratch.
After trying everything, my solution was removing some PNG files, build and run (ok) and adding again the PNG images. Weird!
I will post my solution. This solution worked for me, since none of the previous worked. The issue first occurred right after last update of XCode cli toolset (not sure if this is the confirmation bias).
I tried some of the instructions (ie. Unlock Keychain Trick).
What worked for me in a case of error:
Command CodeSign failed with a nonzero exit code (Something.framework)
Trash DD Content; rm -rf /Users/dx/Library/Developer/Xcode/DerivedData/*
Restart XCode
Build Phases => Link Binary With Libraries
Something.framework,
Set embed value in General => Something.framework => EMBED
Do not embed
Press Cmd+B (Build Project)
Hopefully Built Successful
In my experience, the reason that caused this problem was I wrongly reset the Keychain Access to default, so I lost my development certificate.
How did I solve this?
I cleaned my Apple Development Certificate from Keychain Access
I cleaned my Apple Development private key from Keychain Access
Then I got the new error : Revoke certificate
Your account already has an Apple Development signing certificate for this machine, but its private key is not installed in your keychain. Xcode can create a new one after revoking your existing certificate.
Go to Xcode Preference -> Accounts Tab -> Fine the team name under the Apple ID -> Double Click it -> Click the + button at the bottom left of box -> Select App Development
In the team drop-down of the target, select "None"
Re-select the correct development team
Clean the project by shift+cmd+k
Rebuild the project cmd+b
I, too, saw this error after adding a mixture of .jpg and .png images to the art.scnassets folder, making code changes, and removing those changes via Xcode's Source Control > Discard All Changes... menu.
I tried the other fixes in this thread but, ultimately, I had to delete the added .jpg/.png files, clean the project, and rebuild the project to eliminate the errors. I then readded the original .jpg/.png files and I'm now rebuilding the code without issue.
For me I had to go to keychain, select the "login" keychain, double click on the iOS Developer:myname key, click the access control tab and switch the radio button to Allow all applications to access this item.
This problem was caused by building my project in the Release schema. It can be caused by other things as well. Try to switch the build schema by going in xCode to
Product > Scheme > Edit Scheme. In the "Run" Section located on the left, switch the "Build Configuration" to "Debug". I hope this will help.
None of the above solutions worked for me. After some guess work, I tried (Xcode v10.2.1 cocoapods v1.7.1)
pod deintegrate
followed by
pod install
Then:
Opened the workspace in Xcode
Cleaned build folder
Build the project
No build errors.
My Problem was solved
Check Automatically manage signing on Target MyProject and Add Team.
Check Automatically manage signing on Target MyProjectTest and Add Team.
Product -> Clean Build Folder -> Build again or try to run on device.
The problem occurs when you have the wrong/different team on MyProject and MyProjectTest.
Reconnecting your phone prior to rebuilding may also assist with fixing this issue.
It works for me by delete all the apple developer Certification in the keychain. and generate it in the Xcode.
I was experiencing this issue due to the misconfiguration of my Apple Worldwide Developer Relations Certification Authority certificate.
I resolved issue by switching from "Alway Trust" to "Use System Defaults"
Step by Step:
Open KeyChain
Click on "login" keychain (make sure it's unlock - if it's locked Right Click on it and choose "Unlock KeyChain")
Click on Certificates and locate Apple Worldwide Developer Relations Certification Authority certificate
Right click on it and choose Get info
Expand Trust section and change settings to Use System Defaults as per below screenshot
This issue can also occur when upgrade from XCODE 11.x to 12.0. After installation of new version of XCODE, restart system to overcome this issue.
I fixed this issue only by renaming Resources folder (not group) to any other names such as Resource, Resources123, etc.
None of other answers worked. This is what I have done:
deleted my certificate from keychain;
opened Xcode it rebuild certificate;
ran app on device successfully.
in my case it was a corrupted storyboard file
After i copied two .aiff files in a .scnassets group, this error
occured. Deletion of the files and a "Clean Build Folder" solves the problem in my case.
Not sure if this will help anyone - but make sure you have Find Implicit Dependencies checked off. Sometimes this can lead to your project "losing track" of where to look for certain things.
Once you do this, I suggest then also cleaning your project and rebuilding.

Code Sign Error in macOS Monterey, Xcode - resource fork, Finder information, or similar detritus not allowed

Already tried : Code Sign Error on macOS Sierra, Xcode 8
Please see image showing error
CodeSign /Users/gururajtallur/Library/Developer/Xcode/DerivedData/Flow-bkqjkvtmvjovpyepfjeyqmjpintj/Build/Products/Debug-iphoneos/Super\ Flow\ Flip.app
cd "/Volumes/Development/Project/Top Best Games/19. Lets Flow/35/let's FLOW - source/proj.ios_mac"
export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
Signing Identity: "iPhone Distribution: New Free Games (2CHN583K4J)"
Provisioning Profile: "Super Flow Flipp AppStore"
(c6c30d2a-1025-4a23-8d12-1863ff684a05)
/usr/bin/codesign --force --sign E48B98966150110E55EAA9B149F731901A41B37F --entitlements /Users/gururajtallur/Library/Developer/Xcode/DerivedData/Flow-bkqjkvtmvjovpyepfjeyqmjpintj/Build/Intermediates/Flow.build/Debug-iphoneos/Super\ Flow\ Flip.build/Super\ Flow\ Flip.app.xcent --timestamp=none /Users/gururajtallur/Library/Developer/Xcode/DerivedData/Flow-bkqjkvtmvjovpyepfjeyqmjpintj/Build/Products/Debug-iphoneos/Super\ Flow\ Flip.app
/Users/gururajtallur/Library/Developer/Xcode/DerivedData/Flow-bkqjkvtmvjovpyepfjeyqmjpintj/Build/Products/Debug-iphoneos/Super Flow Flip.app: resource fork, Finder information, or similar detritus not allowed
Command /usr/bin/codesign failed with exit code 1
In Code Sign section its allowing me to select profile and certificate...but still giving error.
How to fix this problem ?
Solution 1:
Apple Developer Website Answers above problem Here.
Execute below command in terminal : First goto projects root folder
xattr -cr <path_to_project_dir>
Clean Xcode and Re-build.
Solution 2:
Just go to project root directory and run this command xattr -cr .
xattr -cr .
Clean Xcode and Re-build.
Solution 3:
You can fix this problem by finding files which holds finder information.
In terminal, goto project root directory and execute
ls -alR# . > kundapura.txt
This creates kundapura.txt in current directory. Now search for com.apple.FinderInfo and clear this attributes for all files. You can do it like this
xattr -c <filename>
Example: xattr -c guru.png
Once you clear all then code sign works. Clean Xcode and Re Build. Cheers
Solution 4: Inspired by Mark McCorkle's Answer
In terminal, goto project's root directory and execute one by one command
find . -type f -name '*.jpeg' -exec xattr -c {} \;
find . -type f -name '*.jpg' -exec xattr -c {} \;
find . -type f -name '*.png' -exec xattr -c {} \;
find . -type f -name '*.json' -exec xattr -c {} \;
Clean Xcode and Re-build.
The error is from attributes inside your image files. This happened from our graphics designer saving images from photoshop with attributes.
Here is a simple command to find all of your png files and remove their attributes. Run this in your projects root directory from terminal. Clean and rebuild; problem solved.
find . -type f -name '*.png' -exec xattr -c {} \;
If you have this error when codesigning an app:
resource fork, Finder information, or similar detritus not allowed
Command /usr/bin/codesign failed with exit code 1
Go to your project root folder and execute
find . | xargs -0 xattr -c
This will clear attributes for all files.
In Sierra, the rules on what can be in a signed bundle have been tightened, and resource forks are no longer allowed. AppleScript has been saving information in resource forks forever, although that information has been unused for a long time. With Sierra, when you save a script, this resource fork information will no longer be saved.
It means you cannot codesign a script that was last saved in a version before Sierra; you have to save in Sierra to be able to sign in Sierra.
The people likely to be affected by are who bundle other scripts within their scripts (cordova?). They will not be able to sign the container script until all the embedded scripts have been resaved under Sierra.
UPDATE:
Seems like this also works:
xattr -rc .
If you have any insufficient permissions error try to prepend sudo: sudo xattr -rc .
The easiest way to handle attributes on your source files is to have Xcode clear up the archive before it runs codesign. To do this:
Select your target in XCode
Select the Build Phases tab
Press the + symbol
Select New Run Script Phase
Enter the following for the script:
xattr -cr ~/Library/Developer/Xcode/DerivedData || echo Clear
Now when you build your target it will clear out any attributes that would have broken codesign. By clearing out at this stage you don't have to alter your source code / project directory.
The "|| echo Clear" part of the script ensures that the project build continues even if xattr errors.
This method is good if you use programs such as DropBox on your code repository that add the attributes, as it doesn't change your source project, only the built archive.
You may need to change the path to match your DerivedData directory - this path will be shown next to the codesign error.
I have used following command. Use terminal window. Navigate to your Project and execute following:
xattr -rc .
There is official Apple answer for this issue in Technical Q&A QA1940.
This is a security hardening change that was introduced with iOS 10,
macOS Sierra, watchOS 3, and tvOS 10.
Code signing no longer allows any file in an app bundle to have an
extended attribute containing a resource fork or Finder info.
To see which files are causing this error, run this command in
Terminal: xattr -lr <path_to_app_bundle>
You can also remove all extended attributes from your app bundle with
the xattr command: xattr -cr <path_to_app_bundle>
<path_to_app_bundle> can be replaced with directory of your Xcode project. For example ~/Development/MyProject
All about clearing files is fine, but tedious for multiple projects.
graphics apps, (like photoshop in old versions) write additional info (we now call it metadata..) in an old fashion in external files, or they came frm older OSX, files like:
"com.apple.ResourceFork" and "com.apple.FinderInfo", when unzipping folder, for example.
Xcode 8 refuses to add it to a build (as You added them to a project with a "git --add ." maybe..)
You can find in terminal recursively and delete them, but can be tedious.
I wrote a small free utility to delete it.. hope it can help..
https://itunes.apple.com/us/app/cleandetritus/id1161108431?ls=1&mt=12
For those (like me) who are just trying to develop an app without having to strip extended attributes on every new photoshop created PNG added to the macOS target, you can temporarily disable code signing by adding a user defined build setting:
CODE_SIGNING_ALLOWED = No
Obviously, one distributing an app needs to eventually deal with the issue but this enables development in cases like mine where it wasn't necessarily straightforward to omit code signing in Sierra (on past OS X / Xcode it was easier to do so).
Per RGriffith's comment, here are a few screenshots for those who aren't sure how the custom build setting is added.
Simple solution:-
How I did [Working for me]
Step 1:-
Go to this folder - from your finder press option Go - > Go to Folder
then type your project path like this
example:-
Library/Developer/Xcode/DerivedData/yourprojectname/Build/Products/Debug-iphoneos
Now you can see a window pop with list of available File, There you see yourApp.app file [ Don't do anything just wait for step 2].
Step 2:-
Open new Terminal and type just cd then just drag step 1 yourApp.app to terminal, now you will get the path for the app, now press enter button.
Step 3:-
Now type this command **
xattr -rc .
Don't miss "."(Dot) press enter button.
That's it, Go to your Xcode project and clean and run again.
-----In case you can't apply the solutions above, because of lack of bash knowledge or something else.
I had this problem as soon as I enabled iCloud Drive on my Sierra. And my project was in a folder which was synced with iCloud Drive. I suppose this is what adds those additional attributes.
Temporary solution:
Disable iCloud Drive for the folder where your project is.
You will need to delete the app bundle folder and rebuild the app as explained below.
My app is called: augment
In terminal window, goto your app folder
e.g.: cd /Users/username/Library/Developer/Xcode/DerivedData/
In terminal window run command for your app folder
e.g.: xattr -cr augment-flmbiciuyuwaomgdvhulunibwrms
Clean>Build>Run.
There is also a free app on Mac Appstore called "CleanDetritus" which will do removal of these.
This problem came to me yesterday.
(What's wrong) I updated image resources by manually replacing file in finder and I failed with this compilation error.
(What's right) Don't update image in this way. After that I dragged images to 'xcassets' in Xcode. No more error appear again.
My problem is every change I make in the code and execute again the error reappears. Then I find a solution to execute the command automatically every compilation/execution of code.
Thanks to #rich-able I discovered "Run Script". Then I put the command "xattr -cr ." in the field.
One of the best solution is
Go to terminal type this
xattr -cr "Full path of your project"
To find full path of your right click on Xcode project->get info -> copy path and replace with .
Then type below command
xattr -cr "Full path of your project"
Clean and build done.
The simplest fix may be if you are using git. Try:
$ git stash
$ git stash pop
Git does not store file metadata, the above will strip it all away.
Open terminal and just run this command.
xattr -cr "path to .app file"
I found that if I add color tag on the folder under DerivedData, it will give the above error when debug on device.
Remove the color Tag fix this error for me.
My problem was that I used cordova to build the app around 1 year ago, but it wasn't compatible with the new version of xcode, so I simply used cordova build ios and it worked again.
If the xattr commands doesn't the trick this may be due to an XCode 9 bug:
let's try to remove and re-add the resource folder (it was a .xcassets in my case) containing the affected files from Xcode. (you should understand which are the affected files previous through the xattr -lr command)
The problem is in the derived data, You should clean the derived data and then clean the project and build. Please check this link.
I'm also facing the same issue, got fixed by just restarting my Macbook.
You can remove the derived data
Xcode -> Preferences
And click on the arrow below Derived Data, and empty the folder Derived Data
I don't know what happened to me, but when I was running flutter app on simulator, I was encountered by the error. I used flutter clean command and removed the derived data and then everything goes fine.
My .app was on a network mounted drive.
codesign -f -vv --preserve-metadata=entitlements -s {*my Apple distribution cert SHA*} my.app
my.app: resource fork, Finder information, or similar detritus not allowed
I don't know if too long path or the fact it was on a NAS device was a problem. I copied the .app to my local Downloads directory, and then was able to codesign.
my.app: signed app bundle with Mach-O thin (arm64) [*com.something.my*]
This happened to me as well when I duplicated a .plist file and edited it, instead of creating a new one. the xattr -lr <path> command helped me identify the problematic file.
My issue was related to unintended changes on framework integrated using Carthage. I had modified one line in framework by mistake and it didn't show up in git because dependency build folder was ignored from git.
Solution : Deleted framework folder in Carthage and rebuilt it.

Cocoa: Command /usr/bin/ditto failed with exit code 1

I am trying to build my project but it is not getting build.
I am getting the following error:
Command /usr/bin/ditto failed with exit code 1
I have cleaned my project but still is issue is persisting.
Xcode Details:
EDIT Solution tried
I went to
~/Library/Developer/Xcode/DerivedData
and deleted everything inside the folder then went back to the Xcode and tried to build the solution. Getting the same error back
Command /usr/bin/ditto failed with exit code 1
clean your project and see whether it help or not
Command + Shift+ K
or
Product > Clean
Or check this link it may helps you: http://codica.pl/2015/12/25/taming-swift-compiler-bugs/
For Mac OS Sierra, this work for me:
cd /Users/YOUR_USER_NAME/Library/Developer/Xcode/DerivedData
then
xattr -dr com.apple.FinderInfo *
and then rebuild your project..
and fix the error!
All of sudden, It happens to my Mac app project today in Xcode 7.3.1.
What I did :
Clean >Clean build folder > Quit Xcode >Open Finder then go to
~/Library/Developer/Xcode/DerivedData
then deleated everything inside >Open Xcode >Build >Run
I think this is happening when something is wrong adding a file into Xcode.
I have not encountered since readding myApp.help file without the option 'Destination: Copy items if needed'.
Look at the error messages and find out which files are affected. Delete these files (remove references) and then add them again to your project's target. It should work now.
Follow this steps:
clear "Derived Data" from files.
Xcode >> Preferences >> Locations >> click on arrow icon(opened "DerivedData" folder)
remove/delete all files from "DerivedData" folder.
clean project(cmd + swift + k)

Xcode build process stuck at "Copying swiftdocs"

Creating a build for my Xcode project takes too much time. It gets stuck at "Copying swiftdocs". I am making a build to run on device. I cant understand why this is happening. No relevant info available on internet. Just for the info, I am using Cocoa Pods in the project.
Is it anywhere related to pods? I am unable to run the app on device.
Xcode stuck indexing error (compiling model, copying swiftdocs, etc.)
Open your Project Folder.
Find ProjectName.xcodeproj file.
Right-Click Copy and Paste to Safe Place.
Right-Click Show Package Contents.
Find project.xcworkspace file and delete that file.
Reopen Your Project and clean and Rebuild.
If your problem is not solved then replace the file with your backup file.
Hope this will work for you. If still not restart your mac some time it works with restart.

Malformed or corrupted AST file

I have a problem I don't know why did it happen in the first place but most probably because I've pressed move to trash to some system frameworks by mistake.
I got an error that says:
malformed or corrupted AST file: 'could not find file '/Users/username/myProject/QuartzCore.framework/Headers/CAMediaTiming.h' referenced by AST file'
I've tried to copy QuartzCore.framework in that Directory. It give me then a punch of new errors. Then if I remove the framework from the Dir. Everything will be good for the project till I make any code change. Then I would have to make the previous scenario again. It's very annoying now and I really need to fix this. Anyone?
As requested:
What caused this error for me (after getting the new Xcode) was I would try to run a project in simulator (accidentally in simulator, I never use simulator), but I'd forget to select my device or my device would become unplugged without me noticing, and it will try to run in simulator... so I would get those classic ".o" file errors... Then I would switch back to my device and get corrupt AST files...
To CURE the problem... (Follow the steps below VERY closely!!!!!)
Clean your project
QUIT Xcode (CMD+Q)
Run this Terminal Command: rm -rf ~/Library/Developer/Xcode/DerivedData/ModuleCache/*
Run this Terminal Command: rm -rf ~/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/*
Reopen Xcode
MAKE SURE YOU HAVE YOUR DEVICE SELECTED AND NOT SIMULATOR
CLEAN project (Yes, again)
THEN build (to your device, not to simulator)...
Enjoy!
Note: After further experimentation I've found that the force-quitting of xCode is possibly not necessary.
In addition to all of the other "clean your build" answers, nothing was working for me until I emptied out the (highly undocumented!) /var/folders directory.
Apparently, this is a "miscellaneous caches" dir maintained by OS-X. I didn't even bother figuring out what were "the correct files"; I just cleaned out the entire directory.
...And now I can build again. Hooray! From terminal:
[sudo] rm -rf /var/folders/*
(Although I did it from Finder, via authentication.) (OS-X 10.9.latest)
Additional clue: I could build with XCode-6-beta, but got the goofy "corrupted AST file" error in XCode-5.
In my situation, all I needed to do was click Product > Clean, then build the project again. It succeeded. Hope this helps some others who run into the same situation.
Hi all I got the same error because I have opened two projects at a time and drag and dropped frameworks from one project to another .
After some time I realised that this is not a right way. I moved all frameworks which are dragged from another project to trash. Then clean and run in simulator everything is working fine.
Delete frameworks->again add frameworks->clean and run
I hope it will help someone
Personnaly, just one solution worked for me:
In Xcode Go to Window -> Organizer
Clic on the "delete" button near the "derived data" directory.
Then Run again your project...
I just clean my project and re-build. Everything back to normal.
In my case, the error was happening because I had a corrupted .m file - it was one that had, somehow (not quite sure how) found its way into my project (I had Eclipse open at the same time and the corrupted file had some java code in it). To fix the problem, I cleaned my project, closed Xcode, deleted the erroneous .m file & re-opened Xcode. It then gave me a clang error due to the now missing .m file. I created a new, empty .m file with the same name and the project ran fine. Bit of a hack but it worked :-)

Resources