ios - How to export "fat" Cocoa Touch Framework (for Simulator and Device)? -


with xcode 6 ability create own dynamic cocoa frameworks.

enter image description here

because of:

  • simulator still use 32-bit library

  • beginning june 1, 2015 app updates submitted app store must include 64-bit support , built ios 8 sdk (developer.apple.com)

we have make fat library run project on devices , simulators. i.e. support both 32 , 64 bit in frameworks.

but didn't find manuals, how export universal fat framework future integration other projects (and share library someone).

here steps reproduce:

  1. set only_active_arch=no in build settings

    enter image description here

  2. add support armv7 armv7s arm64 i386 x86_64 architectures (for sure)

enter image description here

  1. build framework , open in finder:

enter image description here enter image description here

  1. add framework project

actual result:

but in end still have problem running project framework on devices , simulator @ once.

  • if take framework debug-iphoneos folder - works on devices , gets error on simulators: ld: symbol(s) not found architecture i386

    xcrun lipo -info coreactionsheetpicker 

    architectures in fat file: coreactionsheetpicker are: armv7 armv7s arm64

  • if take framework debug-iphonesimulator folder - works on simulators. , have error on device: ld: symbol(s) not found architecture arm64

    xcrun lipo -info coreactionsheetpicker 

    architectures in fat file: coreactionsheetpicker are: i386 x86_64

so, how create dynamic framework works on devices , simulators?

this answer related xcode 6 ios creating cocoa touch framework - architectures issues it's not duplicate.


update:

i found "dirty hack" case. see answer below. if knows more convenient way - please, let me know!

the actuality of answer is: july 2015. things change.

tldr;

currently xcode not have tools automatic export of universal fat framework developer must resort manual usage of lipo tool. according this radar before submission appstore developer framework's consumer must use lipo strip off simulator slices framework.

longer answer follows


i did similar research in topic (the link @ bottom of answer).

i had not found official documentation distribution of research based on exploration of apple developer forums, carthage , realm projects , own experiments xcodebuild, lipo, codesign tools.

here's long quote (with bit of markup me) apple developer forums thread exporting app embedded framework:

what proper way export framework framework project?

currently way have done:

  • build target both simulator , ios device.
  • navigate xcode's deriveddata folder project , lipo 2 binaries 1 single framework. however, when build framework target in xcode, make sure adjust target setting 'build active architecture only' 'no'. allow xcode build target multiple binarty types (arm64, armv7, etc). why works xcode not standalone binary.

  • also you'll want make sure scheme set release build , build framework target against release. if still getting library not loaded error, check code slices in framework.

  • use lipo -info myframworkbinary , examine result.

lipo -info myframeworkbinary

result i386 x86_64 armv7 arm64

  • modern universal frameworks include 4 slices, include more: i386 x86_64 armv7 arm64 if don't see @ least 4 coud because of build active architecture setting.

this describes process pretty same @skywinder did in answer.

this how carthage uses lipo , realm uses lipo.


important detail

there radar: xcode 6.1.1 & 6.2: ios frameworks containing simulator slices can't submitted app store , long discussion around on realm#1163 , carthage#188 ended in special workaround:

before submission appstore ios framework binaries must stripped off simulator slices

carthage has special code: copyframeworks , corresponding piece of documentation:

this script works around app store submission bug triggered universal binaries.

realm has special script: strip-frameworks.sh , corresponding piece of documentation:

this step required work around app store submission bug when archiving universal binaries.

also there article: stripping unwanted architectures dynamic libraries in xcode.

i myself used realm's strip-frameworks.sh worked me without modifications though of course free write 1 scratch.


the link topic recommend read because contains aspect of question: code signing - creating ios/osx frameworks: necessary codesign them before distributing other developers?


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -