Closed Jonazon closed 4 years ago
Yes, you appear to be correct. I had not noticed that yet. I'll have a look and see what I can come up with, but like you say, the solution may not be super straight-forward.
I managed to make something that works. Not sure if I'm that happy with the solution though so I'll continue looking into better ways of solving it.
What I did:
Removed the fliclib.framework from the Target -> General -> Framework, Libraries, and Embedded Content. Also make sure it's not in Target -> Build Phases -> Link Binary With Libraries/Embed Frameworks.
In Build Settings add the following to the Other Linker Flags
Add the following script in Build Phases. I added it after the Link Binary With Libraries phase.
echo $PLATFORM_NAME
echo $SRCROOT
echo $CODE_SIGN_IDENTITY
if [ "$PLATFORM_NAME" == "iphoneos" ]
then
destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"/fliclib.framework
cp -R -v "$SRCROOT"/fliclib.framework "$destination"
/usr/bin/codesign --force --sign "$EXPANDED_CODE_SIGN_IDENTITY" "$destination"
fi
The script is based on how CocoaPods copies and signs frameworks.
Also, Framework Search Paths and Header Search Paths must be set in a way so the linker can find the framework.
With the above changes I'm now able to build and run on both the Simulator and on a real device.
Jonazon, that is a very clever solution 👍 However I really don't like the idea of us requiring custom build scripts to use fliclib. Either we have to have a script (like yours) to avoid importing the framework, or we have to have a script to strip away unused slices (if we were to distribute a fat binary).
So, after some consideration I'm now leaning towards moving over to Apple's new XCFramework packaging format. The main purpose of XCFrameworks is to solve the multi-architecture issues of a regular framework.
However, I do believe Xcode 11 is a requirement in order to use XCFrameworks, which may be a deal breaker for some.
Let me know if you have any thoughts.
Yeah I agree. I'm not a fan of these custom scripts either. This was just something to get us going for now.
A script that strips the simulator slices is the one I've seen other frameworks use but XCFramework definitely looks like the way to go from now on. I actually didn't know they released a new format for that.
I released an XCFramework today that you may have a look at if you still need it. It should be very straight-forward to make the switch.
Any possibility of getting a fliclib.xcframework build for the PBF version of fliclib?
Yes, it is possible. We will release an official one, probably by next week. Although, if you are in a hurry and need access sooner, then we should be able to send it to you directly. Please talk to your PbF contact person at Flic (Ludvig?). Let him know that I sent you his way!
I unfortunately can't share it over github :P
With the release of Xcode 11.4 we're encountering a new error.
Building for iOS Simulator, but the embedded framework 'fliclib.framework' was built for iOS.
It's working fine on older versions so it seems that Xcode 11.4 does a stricter check on what it embeds in a target.
As far as I know there's no easy way to conditionally embed frameworks in Xcode, so it would require some non trivial scripting.