ios8 - iOS 8 extension dependencies issues. Importing one project file to extension view controller -
i working on ios 8 extension. read many manuals , of them show how simple add extension app, , seems that's enough.
but here many pitfalls:
after adding extension need import of classes view controller created when added new extension target. big use here need add of them , if have huge project it's not simple task. solution can select extension target in build phases -> compile sources press plus button , add .m files target using hot key cmd+a.
after adding files can see of method wont work, , can see error:
'sharedapplication' unavailable: not available on ios (app extension)
solution can macros checkifndef extension
can invokesharedapplication
code.#import <foundation/foundation.h>
vs#import <uikit/uikit.h>
. have not figured out issue when replacedfoundation
uikit
works me , related issues go away.- cocoapods. of using cocoapods if extension need use part of project code , code use cocoapods library need add
link_with 'projecttarged', 'extensiontarget'
pod file , makepod install
again bind libraries new extension target.
so main points faced with. maybe can suggest how solve issue, said import 1 needed file extension view controller. imported file contain libraries afnetworking
, restkit
, other nested classes main project. need class invoke few methods passing data extension backend server. 1 file many issues.
you can use in podfile prevent "require app-extension-safe api". put end of podfile.
post_install |installer_representation| installer_representation.project.targets.each |target| target.build_configurations.each |config| config.build_settings['application_extension_api_only'] = 'no' end end end