ios - Is it possible to use a static library only when testing with device and not simulator? -



ios - Is it possible to use a static library only when testing with device and not simulator? -

i have external closed library can compile armv7s (etc) only. when seek compile against simulator not running , display errors. don't want insert library code unless can configure xcode utilize library when test device. unfortunately, tried cocoapods no success , wonder if there way it?

yes, can done. had similar problem framework caused linker errors in simulator setup project utilize framework when building device.

the next assumes not using cocoa pods link library. i'm not sure need changed if are.

select target , go build phases tab. under "link binary libraries" section, remove static library list. go build settings tab. find "other linker flags" setting. double-click on debug value. tap + , come in -lsomelibrary in place of "somelibrary" come in actual name of library minus leading "lib". not include extension. select debug value , notice little circled +. click +. click on new "any architecture | sdk" part , alter "any ios simulator sdk". now double click on value right of "any ios simulator sdk" , remove -lsomelibrary entry added.

now debug build.

the above alter means library linked in builds except ios simulator builds.

you need create code changes. code making reference header files or other symbols library should wrapped follows:

#if !target_iphone_simulator #import "somelibrary.h" #endif #if !target_iphone_simulator // utilize stuff library #endif

ios iphone xcode static

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -