Using agvtool with multiple .xcodeproject files in one directory - ios

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.

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.

Why is xCode asking for Android Studio Gradle files?

I had to delete Android Studio off my MacBook Air to free up space for an xCode update. Now xCode is complaining its missing Android Studio files that have nothing to do with it but are somehow titled
file:///Users/administrator/Documents/Retrographic/Sprocket/Android/Gradle%20Binaries/gradle-2.2.1/lib/plugins/xbean-reflect-3.4.jar: warning: Missing file: /Users/administrator/Documents/Retrographic/Sprocket/Android/Gradle Binaries/gradle-2.2.1/lib/plugins/xbean-reflect-3.4.jar is missing from working copy
What the heck is this and how do I fix it? I tried re-downloading the branch in SourceTree and pointing xCode at it but its still having the same problem. Do I need to just nuke and re-install xCode?
:(
This seems very unusual...
My best guess would be to go through your various build settings in your project targets and ensure that this file isn't listed under anything for linking, building, etc.
If it is, delete it, provided you don't need it for your XCode project.
This error occurs as that file was under your version control system such as git and now it is removed. xcode checks the status of git and complains if a file was removed. You can go to your version control system and commit this change so that xcode doesn't complain. If you are using git, you can do the following:
git status
--> This should tell the file was removed
git commit ...
Some possible solutions.
Solution 1
Open your xcodeproj/project.pbxproj in a text editor
Search for "xbean".
Remove that line.
Solution 2
If you are using an xcworkspace, there may be some other project that is including that file. In that case, I'd do that for all project files. If that is infeasible, do a grep grep -r xbean . and then edit the named files. This command will recursively search for all files mentioning this particular file.
I'm not sure why is this happening, but i think there might be some file references in your project which are no more existing.
You can try this:
Search and delete missing files.

Xcode: issue "file xxx.png is missing from working copy" at project building

After deleting/adding some png files to project, i have got messages when building project.
"file ProjectPath\aaa\xxx.png is missing from working copy."
All these files are in the project, and the application is running. However, these messages are annoying. Looked .plist file, but there is no mention of these files.
What should I do to remove these messages?
The warning will disappear as soon as you commit your changes (Xcode 8).
It seems that this problem may have different causes, but it's often in relation with source control software.
In my case, I solved it by going to Git, and adding the files again. I mean running the following command:
git add .
You can also disable source control by unchecking
Xcode -> Preferences -> Source Control -> Enable Source Control
if you're managing it via command line or any other app.
In XCode -> SoureControl:
Update + Refresh Status did it for me.
In my case, the file was missing from the source control.
To fix, I had to discard this file (be careful only discard the missing file not all your project):
Xcode->Source Control->commit
Right Click the missing file
Choose Discard Changes
Disable Source Control, clean build folder (Alt+Shift+Cmd+K), then Enable Source Control again.
Xcode -> Preferences -> Source Control -> Enable Source Control
In my case, Xcode had somehow found old .svn directories that referenced the missing files. I had to go up a level above my project folder to find those .svn files. Once deleted, I restarted Xcode and everything was fine.
I had a similar issue with a handful of files that had long since been deleted from my Xcode project while I was still using Xcode 7.
My solution was to:
Create files with the names Xcode was complaining about (they don't need any content)
Add the files to my Xcode project (in Xcode right click on my main project directory, click Add files to my_project_name and select the files that were just created
Select the newly added files and delete them - select move to trash.
This got rid of the warnings for me.
To add onto Alexander Vasenin's answer...
First I Committed and Pushed my changes
Xcode Main Menu > Source Control > Commit
Then I Discarded All Changes to get rid of the errors
Xcode Main Menu > Source Control > Discard All Changes
After that, the errors stating "file xxx.png is missing from working copy" disappeared.
This is occurred when you delete file on Xcode, but didnt tell svn server about it.
Go to command line tool, and delete file directly.
svn delete missingFile.m
and commit it
svn commit -m "Deleting file"
note that if you delete .svn folder, the warning is disappear but you will lost communication with svn server.
I worked it out.
just open your third-party SVN tool, find the miss files, Revert;
that's all.
I had same problem and solved it by add git .
Open Command Line Tool
cd "project folder path"
git add .
Later,restart Xcode project and open your project again.
Show on target->build phases -> copy Bundle Resources.
and
clean build folder command+shift+alt+k
I had to manually go into Terminal and remove the files with git rm ProjectPath\aaa\xxx.png and then commit. After that everything worked fine.
Got this for every project after moving on to XCode 8. This solved it:
With Option Key pressed, Product (in title menu) -> Clean Build Folder.
In my case, I had wrong data from my old projects in the simulator. Solved by reset content and settings in the simulator:
Simulator -> Reset content and settings...
For me the following worked:
Since I do not and did never use Git, I created a new project (XCode 8, I could not see the usual "use Git" or however the checkmark was labeled). Then I bluntly deleted all the files in this new project; went to the old messed up project, copied everything in the project folder, came back to the newly created project, pasted the old stuff, opened that - all the warnings about files that have not been existing for months are gone. Fingers crossed.
I had the same issue and solved it by simply dragging the specified files from finder into the project navigator (ensuring that "copy files" is selected in the dialog) and committing the files.
These warnings are not build warnings, they are about your SVN repository.
It is correct that the directories shown no longer exist, CocoaPods stores the headers in Pods/Headers/{Private,Public} now. You have to update your working copy to reflect those changes.
In my case I drag & dropped a number of files on my Xcode project window to add them. It made copies into my source directory but didn't put them where I wanted them to go (it put them at the root of my directory, I wanted them in a sub-directory). Without thinking I just grabbed them in the Finder and moved them to the directory I wanted them in. After going back into the project window it of course could not find them so I deleted them in the window and re added them. After compiling I started getting these errors.
I thought, as some mention above that it was a git issue but when I ran "git ls-tree --full-tree -r HEAD" I didn't see the files at all??
Anyway to fix it all I did was use the "Add File..." menu command to add each of the files to the default location, do a clean build, and then delete them from the project window (using move to trash) and it got rid of all the errors.
I had the warnings, and also could not commit changes under XCode (using svn). All I had to do was restart XCode and the problem went away.
This works for me:
Xcode -> ("option + click") Product -> Clean Build Folder...
Than restart xCode
In my case it was a problem with git and a case-insensitive file system.
I had inadvertently submitted the same file twice, using file paths that differed only in case:
MyProject/Resources/foo.png
MyProject/resources/foo.png
Xcode was complaining about one of the missing files.
Fixed by deleting the offending files, and re-adding.
cd MyProject
mv Resources/foo.png /tmp
git rm Resources/foo.png
git rm resources/foo.png
git commit
mv /tmp/foo.png Resources
git add Resources/foo.png
git commit
This is definitely related to source control. I renamed and moved a couple of non-committed plist files and got this error. I am using svn. I was able to fix this via Source Control - Commit by removing old referenced files.

Issues Using GIT with Xcode projects

I know git and use it to manage a lot of my Repos on other projects. However I run into issues when it comes to xcode projects.
I start a project on Machine 'A' - when I push up to a repo and pull to let say machine 'B' I always receive compiling errors. Normally the errors have to do with files not being found. Literally "no such file or directory" followed by a path.
I'm working with the same version of Xcode on both mac's A and B. I also use the threetwenty framework.
When I zip the project up and send via email - the same results occur.
Many times these files that xcode can't find and that fail the build, are media files, like a image or video. Sometimes I see the three20 framework too.
My question is - how in xcode should I set a project up to play nice with git and or code sharing in general. Let me know if you need more information, I know the above is a little vague.
The first thing I always do is set up the .gitignore file before adding any other files from the project. Problems can occur when loading project settings for two different machines that may have the same User account name. You have to make sure some settings aren't added to the repo whilst others are.
I set up my .gitignore by adding the following:
.DS_Store
*/.DS_Store
*.swp
*~.nib
build/
*.pbxuser
*.perspective
*.perspectivev3
*.mode1v3
*.mode2v3
Documentation/Generated
doxygenWarnings.txt
*.xcodeproj/xcuserdata/*.xcuserdatad
*.xcodeproj/project.xcworkspace/xcuserdata/*.xcuserdatad
*/*.xcodeproj/xcuserdata/*.xcuserdatad
*/*.xcodeproj/project.xcworkspace/xcuserdata/*.xcuserdatad
If you create the repos from scratch or run git rm --cached <filethatshouldbeignore> to each file that should be ignored and then commit, see if the problem still occurs.
Problems will occur in the .pbxproj file, so make sure all conflicts are corrected too.
Regarding files that cannot be found, remember to import the libraries etc. into the project folders and reference them from there. Apple's own iOS libraries should be fine, but others won't be. For example, in your project folder, copy your images from there and reference them only within the project folder.

Resources