There is a nice command that lists all schemes in a Xcode workspace:
xcodebuild -workspace PATH -list
How to extract this list programmatically without xcodebuild? It should be stored somewhere in Xcode project files. But I can't find it inside xcworkspace. For example, in this project.
the schemes are in the xcuserdata -- lone file per scheme
they are build on the fly if they don't exist. (e.g. if that folder wasn't checked in like in that repo)
To build them just enum all targets
the exception being shared schemes: they also come as 1 file per scheme but are in xcshareddata directory.
enum those files to get the schemes. if they don't exist, the user never ran Xcode
Related
I created two schemes with configurations one for development and one for production. And i just moved the info.plist file to another folder called configs.
Now when I try to build I get this build error.
Multiple commands produce '/Users/keghamkarsian/Library/Developer/Xcode/DerivedData/Etadweer-fdhqhseczzvpnebpsxgxctnzasvc/Build/Products/Debug (Development)-iphoneos/Etadweer.app/Info.plist':
Target 'Etadweer' (project 'Etadweer') has copy command from '/Users/keghamkarsian/Documents/APPS/Etadweer/Etadweer/Configs/Info.plist' to '/Users/keghamkarsian/Library/Developer/Xcode/DerivedData/Etadweer-fdhqhseczzvpnebpsxgxctnzasvc/Build/Products/Debug (Development)-iphoneos/Etadweer.app/Info.plist'
Target 'Etadweer' (project 'Etadweer') has process command with output '/Users/keghamkarsian/Library/Developer/Xcode/DerivedData/Etadweer-fdhqhseczzvpnebpsxgxctnzasvc/Build/Products/Debug (Development)-iphoneos/Etadweer.app/Info.plist'
I tried reinstalling the pods, updating the Cocoapods, I tried deleting the info.plist file from the build phases copy bundle resources it displays another error that it could't locate the plist file. So I have to add it to the target again.
What should I do now?
I have several frameworks embedded in my Xcode workspace. In my scheme list, I have four schemes - 2 products: 1 release, 1 beta version of each. Each scheme has its own info.plist, product name, build settings, build path. In my main scheme, my app will build and archive correctly.
When I change to the alternate scheme (release or beta) I get a build error because my embedded frameworks are building in the original build/Release-iphoneos directory and not the build/Release AlternateName-iphoneos. I have tried everything I can think of to get my Framework SearchPaths and Library SearchPaths to point to the embedded framework build directory but I'm having no luck.
Has anyone run into this problem before or have any suggestions? Would the best solution be to have a run script phase that copies the embedded builds into the target directory?
I'm new to iOS development, and I was using this guy's oauth implementation:
https://github.com/Christian-Hansen/simple-oauth1,
so I built a project based on his project file for simplicity's sake.
After a while I realised that I didn't like the folder structure, so I changed it by renaming some folders. I had to replace a bunch of files that came up red. Now I get these errors when I try to compile:
- Check dependencies:
Warning: The Copy Bundle Resources build phase contains this target's info.plist file '/Users/Manuel/Desktop/MyApp/MyApp/MyApp-info.plist'
- Precompile MyApp-Prefix.pch ...in /Users/Manuel/Desktop/MyApp/Simple-OAuth1
... a bunch of ProcessPCH stuff here that I can't decipher
clang: error: no such file or directory: '/Users/Manuel/Desktop/MyApp/Simple-OAuth1/MyApp-Prefix.pch
clang: error: no input files
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
I have changed the folder name from Simple-OAuth1 to MyApp. I replaced the prefix file so it's not red anymore. Is there some setting somewhere that I need to change to get it to work? I also tried cleaning the project.
go to 'Build Phases' in your Target and remove the .plist file from 'Copy Bundle Resources'
go to 'BuildSettings' in your Target and search for 'Prefix Header' there you should check if the path is the same as your new/current .pch file
When you rename folders in your project sometimes you have to update the Build Settings in your project, especially when you rename the folders for things like *-info.plist and your *-prefix.pch files. But luckily this is simple to do following the below steps:
Updating *-prefix.pch location
Open your project up in xcode
Navigate to Build Settings for the Target you need to update.
In the Build Settings search bar type in "Prefix Header" or just "pch".
Double click the value field for Prefix Header and enter the new location for your *-prefix.pch file.
Save.
Updating *-info.plist location
Open your project up in xcode.
Navigate to Build Settings for the Target you need to update.
In the Build Settings search bar type in "Info.plist File" or "plist".
Double click the value field for Info.plist file and enter the new location of your *-info.plist file.
Save.
I need to archive a specific scheme from my xcodeproj. To do this I run
xcodebuild archive \
-scheme $SCHEME \
-target $TARGET \
-archivePath $ARCHIVE_PATH
Although I explicitly define a scheme and target, the resulting xcarchive contains both targets and the follow-up IPA export call complains with
error: the archive at path '<path>.xcarchive' is not a single-bundle archive
** EXPORT FAILED **
Why does xcodebuild produce an archive with multiple bundles?
It was a problem with the project's schemes. I created new Schemes by duplicating the original one instead of adding a new one. The resulting scheme then listed 2 targets in the build section instead of one (only god knows why) and Xcode would not let me remove the other target.
Once I removed all schemes and created them from scratch everything worked just fine.
One more scenario when this happens is when your sub-project(Target dependency) has Skip Install set to No in build settings.
To find which sub-project, check the content inside the archive. Products folder should have only one product.
In my case a sub-project was a dynamic library and was added in the archive under /<path to archive>/Products/usr/lib/<library> path.
I created a project with static library.
When I tried to archive, It fails and library Headers are missing.
But when I build the app, it works fine.
And in build folder headers, bundle resources and library are created outside app file.
Is it possible to create these file in app file and archive
or any other process available for archiving?
Thanks in advance.
If you are able to build the app but not archive then it seems that the build settings that you are using for archive build configuration (probably Release) is not correct. Quick test will be to change the build configuration for archive to same as build, most probably Debug (you can do that in Product->Scheme->Edit Scheme).
To fix this you can open the Build Settings for your target, search for "Header Search Path", click the ">" to open this setting and fix it for the build configuration that is used by archive (i.e. make it same as the build configuration used by Build)