Xcode build process stuck at "Copying swiftdocs" - ios

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.

Related

unity - xcode build failed with NSUserDefaults.mm file not found message, possibly because com.unity.services.core folder is not in project folder

building an XCode project with an .xcodeproj file generated by unity 2021.3.3f1 fails with the message "Build input file cannot be found: 'users/---/ --project name--/Libraries/com.unity.services.core/Runtime/Device/UserIdProviders/NSUserDefinitions.mm' "
When I look in Finder, I notice that the com.unity.services.core does not exist under the Libraries folder.
Some background. I recently moved to trash many Xcode files to free up disk space. I also did a new remove and Install of XCode, in case I deleted anything important accidentally. Non unity files work fine in XCode.
This might be the first project I used 2021.3.3f1 for. I previously used 2019.4.14f1 without encountering this problem.
Is there something I should set in the IOS Player settings of Unity BuildSettings to avoid this problem? (or something that would force the com.unity.services.core folder to be generated in the output project)?
I am very inexperienced in Mac and infrastructure so I apologize in advance if I am missing something very basic.
Thank you
You should clean your build folders and build anew, should work.
In Xcode you can do this by going to Product > Clean Build Folder, in Unity you just manually delete the whole Build output folder (I hope you created a seperate folder specifically for the Build output and didn't just export to the project directory in that case don't delete your project directory just set a new Build output folder ;).

iOS build time error Asset.xcasset No such file or directory

I'm getting an error while trying to run the app on the simulator, using Xcode 12.4
/Users/apple/Library/Developer/Xcode/DerivedData/CCBC-
exyindmimlkaxncxdeubzcgqxqgc/Build/Intermediates.noindex/CCBC.build/Debug-iphonesimulator/CCBC.build/Script-7DBCCAD36C20635EF76D902C.sh: line 4: /Users/apple/Desktop/MyProjects/CCBC_iOS/CCBC.xcodeproj/xcuserdata/.xcassets/Asset.xcasset: No such file or directory
When I select the Asset.xcasset from files in Xcode it shows the file path as /CCBC_iOS/CCBC/Asset.xcasset
Thanks for your help
For me, I had to delete an old script that references this Asset file to be built within Derived Data. Regardless of how much I deleted Derived Data and cleared Build Folder, this script still runs the XCAssets reproducing this bug. I would recommend checking out your Build Phases and Scripts and removing unnecessary files especially for old projects.

XCode workspace integrity - couldn't load project (pods.xcodepoj)

I pulled from git and everything works fine except I got this error even though I can still run the project. Is there a way to fix this?
This usually means there was a merge conflict that got committed to the actual project.pbxproj file.
Since this is a Pods project (which is ephemeral and can be recreated at will) you can run pod install from the command line (in the same folder as your Podfile and it will regenerate the project.
problem:- Workspace integrity (could not load project) I got the same issue also I hit and try many solutions (Restart mac, Cache data remove, pods update, pods install, etc) but all in vain.
Solution : Once I try to open the project the "Xcode.copy" opened intead of my original Xcode . I just close all projects after that I open the project from selecting Xcode directly from the finder.
Note:- do not go to the project folder then open project from "projectName.xcworkspace"
you just need to go finder(Spotlite search) and open Xcode and open from finder then you must select the desired project. The project will work perfectly and after that you can open project manually (in your folder etc)
:) These things working from my side.

Cordova project from .zip fails to build ios, tries to write to directory from other computer

After successfully creating, building, and emulating Cordova's Hello World project, I unzipped the project folder that I am taking over from another developer on a different machine and saved it locally. While I can run the iOS app from XCode with the built project from the previous developer, I can't run the $ cordova build ios command successfully to rebuild it on my machine.
It give the following output:
The following build commands failed:
Check dependencies
Write auxiliary files
When I run it in debug mode, I notice that both of these commands are trying to make a directory for the old dev's computer (/Users/hisName/whereHePutIt/CordovaProject/stuffItIsTryingToBuild) rather than one relative to my project folder (/Users/myName/whereIPutMine/CordovaProject/stuffItIsTryingToBuild).
There is a lot of text to comb through, but it looks as though it is always failing while attempting to make a directory in /Project/platforms/ios/CordovaLib/build/CordovaLib.build
I am really stumped by this because I can't find any sort of setting or file in the project that tries to write anywhere but a path relative to my project file, and Android builds and emulates fine.
I had a similar issue on Android actually. My home for sdk tools moved but the project still wanted to use the old sdk tools.
The solution I took was to remove the platform and then re-add it. I am sure there is a way of going through the existing files and patching this, but everything you should need is in the plugin/ and www/ and where ever you elected to keep your assets.
If you do try this, make sure to create a backup before removing the platform -- it would be awful to lose changes that someone might have jammed down in the platform/ios folder.
I just ran across this issue under similar circumstances - unzipped a zipped copy of a iOS Cordova app from a coworkers computer to continue developing it, and found I could not successfully run the cordova build command.
I managed to get this to work by deleting the old "Debug-iphonesimulator" folders that had been zipped up with the rest of the project from the other computer, and then re-running the build command.
There were two folders that I deleted:
"../ios/CordovaLib/build/CordovaLib.build/Debug-iphonesimulator"
and
"../ios/build/ProjectName.build/Debug-iphonesimulator"
Hope this helps someone!

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