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:

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

  2. after adding files can see of method wont work, , can see error: 'sharedapplication' unavailable: not available on ios (app extension) solution can macros check ifndef extension can invoke sharedapplication code.

  3. #import <foundation/foundation.h> vs #import <uikit/uikit.h>. have not figured out issue when replaced foundation uikit works me , related issues go away.

  4. cocoapods. of using cocoapods if extension need use part of project code , code use cocoapods library need add link_with 'projecttarged', 'extensiontarget' pod file , make pod 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 

Popular posts from this blog