Embedded framework build directory not matching scheme - ios

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?

Related

How to specify configuration for framework in Xcode?

I cannot understand how to specify configuration for framework
For example, I have the project "MyProject.xcodeproj" with 3 configurations: Debug, Stage and Production. The project includes my framework "Xelby" so when I trying to build the project Xcode fails with error "Xelby framework not found".
Xelby has 2 configurations Release and Debug. So I don't understand how to specify Release configuration of Xelby on Stage configuration in my project.
I tried to add Release folder to Framework Search Paths but Xcode began to behave inappropriately, constantly hung up and other

Carthage build umbrella framework

We are developing a dynamic umbrella framework which consist of several other frameworks. Our framework structure is in below
Base.framework
SubFramework1
SubFramework2
SubFramework2.1
SubFramework2.2
SubFramework3
And our xcode project file for the umbrella framework(Base.framework) is structured like this.
But when I execute carthage build command , it finds some of the sub frameworks and doesnt able to find some of the sub frameworks.
What should I do in order to compile the framework as its structured in our xcode project
You can see our framework in the below link:
https://github.com/Kandy-IO/test-cp
(All the subframeworks are in SubFrameworks folder of CpaaSSDK.framework)
Make sure that all the sub frameworks are exposed to carthage build system by selecting them as shared schemes.
Shared schemes
As mentioned in carthage doc on github.
Share your Xcode schemes
Carthage will only build Xcode schemes that are shared from your
.xcodeproj. You can see if all of your intended schemes build
successfully by running carthage build --no-skip-current, then
checking the Carthage/Build folder.
If an important scheme is not built when you run that command, open
Xcode and make sure that the scheme is marked as Shared, so Carthage
can discover it.
Doc Link - https://github.com/Carthage/Carthage#share-your-xcode-schemes

Not able to link a Carthage framework to Xcode project

I am trying to link a new framework downloaded via Carthage to one of my project but getting a linker error:
I'm following these steps:
Updated the Cartfile with the framework location.
Run carthage update command to fetch the framework.
Under project target -> Build Phase added a new Run script and renamed it to Framework Copy.
Added the script to copy the framework from the file system : $(SRCROOT)/Carthage/Build/iOS/CleanroomLogger.framework.
Dragged and dropped the framework from the mentioned location under Link Binary With Libraries section of project target -> Build Phase.
Double checked the Framework Search Path under build settings and it seems to be set correctly : $(PROJECT_DIR)/Carthage/Build/iOS.
Am I missing something?
Eventually it turned out to be deployment target issue. The framework I was linking was supported with minimum deployment target as 8 and I was running with 7 :). I wish the build error could be more descriptive.

Lipo error with additional schemes in XCode

I want to create additional build configurations and schemes in my XCode project in order to build sepcific archives for TestFlight. One connected to our DEV environment for internal testers, and one connected to our PROD environment for external beta testers.
So I was following this excellent blog post and I created 2 additional build configurations by duplicating the Release one. Then I created 2 additional schemes based on the default one, by changing the build configuration of the Archive build operation to the proper build configuration. Finally I set some user-defined settings in each build configuration to point to the right server URL depending on whether we are in a DEV build or a PROD build.
But now when I archive my project using one of these two additional schemes, I get the following Lipo error:
/fatal error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo: can’t open input file: /Users/sarbogast/Library/Developer/Xcode/DerivedData/Build/Intermediates/ArchiveIntermediates/MyAppTestFlightPROD/IntermediateBuildFilesPath/MyApp.build/TestFlight PROD-iphoneos/MyApp.build/Objects-normal/armv7/MyApp (No such file or directory)
And indeed when I go to /Users/sarbogast/Library/Developer/Xcode/DerivedData/Build/Intermediates/ArchiveIntermediates/MyAppTestFlightPROD/IntermediateBuildFilesPath/MyApp.build/TestFlight PROD-iphoneos/MyApp.build/Objects-normal/armv7 directory, there is no MyApp file or directory in there.
I read here and there that setting 'Build Active Architecture only' to YES might solve the problem, but I don't want to do that as these are release builds for TestFlight and I want them to work on all architectures.
Any idea what might be wrong in my set up?
I am using CocoaPods and I had log messages saying that the linker could not find Pods for my new scheme. So I added my new scheme to link_with in my podfile and now it works perfectly.
I still don't understand why, because I thought link_with was only to list targets and this is not a target, this is a scheme. But it works.

Archiving xcode project that contains static library

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)

Resources