Archiving iOS Project with Framework Code - ios

I am developing two iOS apps in Swift that have common code and resources, so I moved the shared parts to a Swift-only Framework. The app projects and the Framework are grouped together in an Xcode Workspace. Everything works fine when I build and run the apps in Xcode.
Problems arise, however, when I try to Archive an app, validate the Archive, and upload the Archive to iTunes Connect. I have tried various combinations of embedding a binary, linking a Framework, and dragging the Framework into the app's projects. I don't really understand what I am doing, so it's just groping in the dark.
Can somebody tell me the correct way to link/embed my Framework into my app for distribution? I would like to know how to do this without a third-party dependency manager. Thank you!

I've countered such situation.
Did you use Framework project in your workspace?
If so, you have to add the framework in embedded binary in project's setting.
You can find it in first tab in setting.
When you test it in simulator, there is no error.
But if you want to build it for device or archive for uploading binary, you need to add it in embedded binary setting.
If you want I can help you to do it through teamviewer.

Related

Kotlin Multiplatform iOS Integration. Issue in linking shared.framework for respective architecture

Kotlin iOS Integration:
KMP is creating a separate shared.framework based on architecture (Simulator/iPhone). Both the frameworks are generated under the Debug directory. As the frameworks search path is set recursive it searches for incorrect framework and throws error and my iOS apps compiling fails.
I am not able to find out which framework to link depending on selected platform Device/Simulator.
Just wanted to know if there is any possible way to handle this issue of multiple frameworks so I can switch between Simulator or Device and the Xcode matches and applies the correct shared.framework
I needed to add /$(CONFIGURATION)/$(SDK_NAME)and make it as non-recursive.
Now even if I run app on simulator and then on actual device, Xcode maps & links correct shared.framework.
This solved my issue.

Bitcode issue when building a Universal (FAT) iOS Framework which has external dependancies integrated via a podspec

My goal is to build a universal framework that can be use in iOS devices and simulators. I want to be able to distribute this framework using cocoapods which also I was able to do successfully.
My framework has some external dependancies, the main one being AWSLambda which I included in my podspec which seems to give me the issue.
I was able to build and embed my framework into a test project by manually dragging the framework into the test project or by installing it via cocoa pods. On both occasions, running the project on a device or a simulator had no issues and everything worked fine.
However, when I tried to archive the test project to submit it to TestFlight, the process failed with the key warning being FrameworkName was built without full bitcode.
A popular solution which came up is to set enable bitcode to no, however I don't think this is the right solution for this project at least as I am building a Framework which will be integrated into other projects and asking client applications to disable bitcode does not seem the right way to go. If it was a personal app I may have taken this route.
So to resolve this, I took some help from stackoverflow and here is what I tried
This stackoverflow answer first
In Build Settings of the framework project set Other C Flags to -fembed-bitcode
In the Build Settings of the framework target add a user defined flag called BITCODE_GENERATION_MODE with the value of bitcode
Both in the framework project and target, Enable Bitcode should be set on Yes
Similar answers were repeated here which I tried.
Here is another answer which I tried where the person recommends to set Skips Install to No and archive the framework instead of building it.
While trying this standalone or in combination, the building of my framework still fails however, this time it is not referring to my Framework but it is referring to my pod dependency AWSLambda.
Adding this to the podfile seems to solve the problem of building the framework, however again I am faced with the challenge of asking the user's to include this into their podfiles which does not strike me as professional or I could be wrong ?
I wanted to know what were my options when it came to such errors with dependancies and is there any way to overcome this ?
I am not sure if such things can be added to the podspec to overcome these challenges.
I probably will have to make a compromise somewhere but it would be nice to get some advice on how to solve this issue.
Thanks

Is there a way to create a precompiled library that contains both Arm and x86 code, and can be called by macOS, iOS, and the iOS Simulator?

I want to create a precompiled library to avoid distributing some proprietary source code. I followed a tutorial here:
https://medium.com/#paulsoham/how-to-make-universal-static-library-a-file-in-ios-using-xcode-42b4b5757075
This works partially, but the problem is that I'm not able to use Lipo to add both the Mac/x86 and iOS Simulator/x86 binaries to the output file. If I add the Simulator binary, then using the library in a Mac app fails. So my question is, what is the correct way to do this?
I also read somewhere that you cannot submit apps using libraries created in this manner to the App Store. Is this true?

Creating pod from Unity iOS project

I have created a game with Unity.
I have exported it as a Xcode project.
I want to create a pod from that Xcode project.
My problem is that the exported Unity project has a Native folder that contains way too many files.
When installing my podspec for the Unity project my computer runs out of ram when trying to write up the Pods.xcodeproj.
Has anyone faced a similar problem as this one?
No you can perfectly do that. But in order to achieve what you are asking, you should your game as a view in native ios and then use cocoapods to add extra capabilities to your ios app. In this case your game becomes like a component in your native ios app and you can play with the rest of your app as you wish here is a guide that can help you;
https://github.com/jiulongw/swift-unity
You probably should not do that. Unity creates a XCode project that is not supposed to be versioned or reused in any way. It is just necessary to create a working iOS version of your game and sometimes used for debug proposes but it is an ephemeral thing. If you want to redistribute your game you should do it using the Unity project itself.

iOS build and distribute a private framework

I have a problem, I'm developing for work a Swift private framework and we have to distribute it.
The problem is how to build it, Xcode by default split the build for the simulator and the build for the physical device.
Googling I find how to merge this two different build, but int this case I have problem when I try to upload to the app store an app with the framework inside.
Do you know how Fabric does?
Thanks you all!

Resources