Prefix.pch framework file not found error xcodebuild - ios

I'm trying to build an app using the xcodebuild command.
I'm using this commmand xcodebuild -project appNameWithExtension -target name -sdk iphoneos -configuration Release"
I have a framework added to my app and when I try to build with xcode there are no problems but when I try to use my xcodebuild command I get this error
/path/appname-Prefix.pch:16:13: fatal error: 'frameworkname/frameworkname.h' file not found
It's pointing to this line of code in my Prefix.pch file
#import <frameworkname/frameworkname.h>
Does anyone know a way to make the xcodebuild commmand find the framework, because it seems like I'm missing something in the command to tell it where to find the framework. I can build with xcode, but I can't build from commandline, so I'm probably missing something?
Any help would be much appreciated :)

Related

How can I build the Xcode-generated Swift Package Workspace with xcodebuild?

When you open a Package.swift file, Xcode will generate a workspace with the path: .swiftpm/xcode/package.xcworkspace.
I'd like to use xcodebuild to build this but it does not seem to work. The error messages are not helpful, just tells me that clang failed.
The actual command I'm running is:
xcodebuild -workspace .swiftpm/xcode/package.xcworkspace -scheme MyLibrary-Package -sdk iphonesimulator OTHER_SWIFT_FLAGS="-D SWIFT_PACKAGE"
Funny enough, trying to build a scheme that describes an individual target works:
xcodebuild -workspace .swiftpm/xcode/package.xcworkspace -scheme SpecificTarget -sdk iphonesimulator OTHER_SWIFT_FLAGS="-D SWIFT_PACKAGE"
Am I missing some build flags needed to build the combination scheme? Has anyone else struggled with this and have any advice?
Note:
The ultimate goal here is to be able to verify that my Swift Package builds in CI. If there is an easier way to achieve this goal then I'm happy to go another route. (The easier might just be multiple commands to build the individual targets but this is less robust)

Building project using xcodebuild fails with Xcode 7.2

I just moved to Xcode 7.2 and am trying to compile a dynamic framework using xcodebuild and lipo
xcodebuild -project ProjectName.xcodeproj -scheme ProjectName -sdk iphonesimulator
This command fails with strange errors like Unsupported architecture (in frameworks like CoreText). The issue has also been discussed here but I don't see a solution which would work. Any help?
This is due to a bug in Xcode 7.2 (and 7.2.1).
A workaround suggestion has been provided in the supplied link since this question was asked. To sum up, you can add the parameter PLATFORM_NAME=iphonesimulator, and then it magically works. For example:
xcodebuild -project ProjectName.xcodeproj -scheme ProjectName -sdk iphonesimulator -arch i386 PLATFORM_NAME=iphonesimulator build
See also my answer here (where there is also another suggestion for a workaround)

Xcodebuild is not creating an app

I'm trying to create a simulator app to submit to Facebook for review. I've followed their instructions to the letter, but keep running into problems. I am using CocoaPods and have a workspace instead of a plain old project. Here's the command I'm running:
xcodebuild -arch i386 -sdk iphonesimulator8.1 -workspace [APP].xcworkspace -scheme [APP]
I get a ** BUILD SUCCEEDED ** message, but either one of two things will happen:
No build folder is created, and I can't find where the .App file is.
A .App is created in a build folder, but is 0 bytes in size and crashes when running with ios-sim.
I read that changing the Run scheme to 'Release' might fix it, but that didn't do anything. Any ideas?
So, I had the same problem and solved it by doing the following:
I made my app as release build instead of debug in xcode: Product->Scheme->Edit Scheme and then Build Configuration set to Release.
After doing this I then went back to the command line and added a destination for the build:
xcodebuild -arch i386 -sdk iphonesimulator8.1 -workspace [APP].xcworkspace -scheme [APP] -derivedDataPath /path/to/build
If you are still having problems make sure you clean and build all of your targets (pods included) and try the above steps again.
Hope this works; it did for me.

Checking for Errors Running xcodebuild (Command Line) for iOS

I'm currently working on a script to build my iOS projects.
I am able to run the archive command using...
xcodebuild -workspace <workspace_name> -scheme <scheme_name> 'archive'
But what is the best way to check for errors? If there is a way to do it without parsing the logs, it would be great. However, if parsing the logs is the best way, what's the best string to look for?
I tested for return codes. xcodebuild returns 0 on success, but also when there are build errors.
Thanks in advance!
Using -project parameter, you can build your project. Goto your Project.xcodeproj folder on terminal. Then type,
xcodebuild -project projectname.xcodeproj
Check this xcodebuild reference .

xcrun error: Failed to read entitlements from

So im trying to automate the build and archive process through a script. In my script, I run the xcodebuild script and that builds fine. Then I try to run the xcrun
/usr/bin/xcrun -sdk iphoneos PackageApplication "path_to_.app" -o "output_path" --sign "devname" --embed "provnprofile"
However I get this error:
error: Failed to read entitlements from '/var/folders/U5/U5q0xqZRG6SrO8AMQkMjeE+++TM/-Tmp-/fIcrdMUa76/Payload/MyApp.app'
Anyone have any ideas why?
Thanks in advance
I just encountered the same issue. It was actually related to my .app folder generated with xcodebuild which wasn't successfully built.
Try to use xcodebuild with the verbose (-verbose) enabled and check the stack trace.
I hope it will help.
double check the package you are building in Xcode. Very often, a project has multiple packages and targets to build. You might have selected a distribution package or not the one you intent to build.

Resources