Skip to content

Instantly share code, notes, and snippets.

@btctcn
Last active January 20, 2020 11:29
Show Gist options
  • Select an option

  • Save btctcn/139c3c4a07ca115146072e57c1286329 to your computer and use it in GitHub Desktop.

Select an option

Save btctcn/139c3c4a07ca115146072e57c1286329 to your computer and use it in GitHub Desktop.
from here: https://forums.xamarin.com/discussion/126860/sharpie-pod-bind-and-simulator-architecture
I solved this problem by creating Release-iphoneos framework and Release-iphonesimulator framework and then merged them using lipo.
Most answers would end here, but I will give you the steps as well :)
Here is the solution:
1. sharpie pod init ios YourPodName
Sharpie will create a dummy iOS app 'ObjectiveSharpieIntegration' with your pod as dependency.
This will create a podfile, podfile.lock and Pods directory within the directory where you have run your command.
2. sharpie pod bind
This command will only create Release-iphoneos framework within build directory.
In order to create Release-iphonesimulator framework, you need to follow steps 3 and 4.
3. Open Pods/Pods.xcodeproj in XCode
3.1. Go to project navigator and select top-level Pods.
3.2. Select your pod in targets and go to Build Settings.
3.3. Add Valid Architectures: arm64, armv7, armv7s, x86_64, i386
3.4. Set Build Active Architectures Only to 'NO".
4. Build Release-iphonesimulator framework
4.1. Product > Scheme > Manage Schemes... > Select your pod.
4.2. Product > Scheme > Edit Scheme... > Change Build Configuration to Release. Close
4.3. Select any latest simulator for building the framework and then Product > Build.
Now you will find Release-iphonesimulator in your build directory.
The last step is to create universal library as follows.
5. Merge the frameworks into a single universal-framework
5.1. Create a new directory within build directory as Release-universal.
5.2. If your pod builds are frameworks then copy and paste the Release-iphoneos framework in Release-universal directory and then delete YourPodName.framework/YourPodName file. Else if your pod builds are static binary (.a) files then copy and paste the build/Release-iphoneos/YourPodName directory in build/Release-universal/.
5.4. For framework:
lipo -create [path to Release-iphoneos framework] [path to Release-iphonesimulator framework] -output [destination path to universal-framework]
For example: lipo -create Release-iphoneos/MyTestAppEx/MyTestAppEx.framework/MyTestAppEx Release-iphonesimulator/MyTestAppEx/MyTestAppEx.framework/MyTestAppEx -output Release-universal/MyTestAppEx.framework/MyTestAppEx
For fat static binary:
lipo -create [path to Release-iphoneos binary] [path to Release-iphonesimulator binary] -output [destination path to fat-static-binary]
For example: lipo -create Release-iphoneos/MyTestAppEx/MyTestAppEx.a Release-iphonesimulator/MyTestAppEx/MyTestAppEx.a -output Release-universal/MyTestAppEx/MyTestAppEx.a
Done!
6. Verification
If you want to check the supported architectures in your newly created universal files, then run the command:
lipo -info YourPodName.a
OR
lipo -info YourPodName.frmaework/YourPodName
Hope this helps someone. :)
Let me know if you still have any doubts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment