Xcode 6 project folders - ios

I am having issues since upgrading to xcode 6 with renaming or moving a project. In older versions I could rename the parent directory of a project safely.
For example:
from:mybasefolder/ios/App/App.xcodeproj
to:
newname/ios/App/App.xcodeproj
Now when I do this it seems to mess up the whole build cycle and keeps pushing to the device an older binary and all debugging stops working. I have been looking through the project settings but I cannot find anything related to paths for this. Does anyone know why this is happening and where I might be able to fix it?

It appears to be cached data in the "build/" directory. If you have your build location set to "Legacy" in Settings > Locations > Devived Data > Advanced.
Steps to reproduce.
Create project
Build project, files in build/
Move project
Build project, files will continue to build to original location, you can verify by looking in Finder, there will be a new folder at the old location with only build/ in it.
Steps to fix:
Delete the old build/ dir if xcode mistakenly created it.
Delete the build/ directory in your project dir.
Clean and rebuild.

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.

What is the "/ios/index/DataStore" Folder for in React Native Development

I am basically wondering if I should exclude the /ios/index/DataStore Folder within my react-native init Project from version control.
The default .gitignore file doesn't exclude it but it seems that the contents of this folder change with each build and can easily be regenared by running react-native run-ios.
Couldn't find any information what this folder is actually for.
xcodebuild indexes your project in order to speed up subsequent builds, you are safe to .gitignore this directory. If you'd like you change its location, that can be done via Xcode > Preferences > Locations > Advanced.
preferences window
Regarding a react-native project it's probably best to leave these settings alone as you are using the build scripts which are (as of react-native 0.53.0) hard-coded into react-native-cli.

Using agvtool with multiple .xcodeproject files in one directory

I have tried using agvtool for ios build versionining. It works great when there is a single .xcodeproj file in the directory. In my case, our project structure is such that it has 4 .xcodeproj files in a single directory. When firing agvtool command in this directory it throws error message, 'agvtool does not work with multiple projects in the same directory'. Anyone has any idea how can I make agvtool work with this folder structure?
For people finding this post and using Fastlane, I just wanted to tell about the plugin https://github.com/SiarheiFedartsou/fastlane-plugin-versioning which have a increment_version_number_in_plist command which does not use agvtool (and support multiple .xcodeproj files in a single folder.
You just need to install the plugin above and replace your increment_version_number action with increment_version_number_in_plist .. they have a very similar contract.
For me, there were actually 2 xcode project files. i.e. projectName.xcodeproj and projectNameModule.xcodeproj. That happened as I removed some commits where we updated the project name from projectName to projectNameModule. For some reason even after reverting those name changes, the project *Module.xcodeproj and *Module.xcworkspace files were still existing.
I just deleted those unused files and it fixed the issue for me.

How to force XCode 4 to always update resources?

I am adding resources (lots of .pngs and other) to my iPhone project dragging the folder to it and choosing "Create Folder references for any added Folder", to retain the folder structure.
They are correctly added to the Copy Resources build phase.
Problem is, I am wasting A LOT of time because when I create/delete/update a new resource, it will often ignore changed files and stick with the older version.
Looks like it tries to only updates resources when they are changed, but it fails to see the changes.
In the simulator it was possible to manually update the files in the .app, but when working on the device it will complain that the code sign of some resources has changed!
The only reliable way I've found to force it to update everything is deleting the build products, the app and the device app some times, until it finally decides to forget about the old version, but doing this for each resource change is wasting me an insane amount of time (game content changes more than often).
So, in short: how do I force XCode to disable "versioning" and to just scrap all the resources and copy them all each time?
Thanks!
EDIT: I have found that deleting the .app folder built in "build" folder always forces XCode to add new files...
I still have no clue on where it keeps the old files when I delete that folder, but this is for the better as it only copies new resources as intended.
So a simple script like
rm -rf "$CODESIGNING_FOLDER_PATH"
Does the trick of deleting the folder at each build...
Unfortunately, XCode apparently runs the codesigning BEFORE anything in the Build Phases tab is executed, so it updates the old target, the script deletes the old target, and then it crashes complaining that no Code Signing Resources were found.
So... I have to stick with manually deleting the file, or is there a way to run a script before code signing?
I had this kind of issue as well, about files not getting updated when I built my project (A PhoneGap project, but that should not matter).
What I did, was add this to the Build Phase of my project:
find "${PROJECT_DIR}/www/." -exec touch -cm {} \;
That will make sure the files are being picked up as updated when XCode builds the project. Of course, you should modify the command to your needs - my needs were to update the www folder on build, as I am editing my files using Visual Studio, running in a VM.
Ok, I finally found a (somewhat ugly) workaround against this.
In you project, create two aggregate targets, say Clean Build and Cleaner.
In Cleaner, add a "Run Script" Phase with rm -rf "$CODESIGNING_FOLDER_PATH" that will purge the temporary app from the build folder.
In Clean Build, add first Cleaner, and then your normal app target to the Target Dependencies.
Select Clean Build from the run list, then Edit Scheme and set your app target as the executable. Hit run, and it should work :)
You might want to use the Clean option under the Product menu (or hold down shift and command and press K) after you update a resource and before you build the updated app. I have noticed that this has helped me out at times when I update a resource or a user-defined build setting.

Resources