Wenfengcheng / xamarin-notes

xamarin journal
MIT License
3 stars 0 forks source link

"sharpie pod bind" missing simulator architecture #23

Open Wenfengcheng opened 5 years ago

Wenfengcheng commented 5 years ago

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.3. 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.