xcode - How can I use Chartboost with Cocoapods in Swift? -


this podfile

platform :ios, 8.0 use_frameworks!  pod "chartboostsdk" pod "svprogresshud" 

svprogresshud being turning framework, reason chartboost not.

enter image description here

that of course makes import chartboost not working in code.

the library chartboostsdk not supported swift directly using cocoapods, need integrate manually in following way:

1.first, unzip sdk package , drop chartboost framework xcode project. sure you've linked these frameworks:

  • storekit
  • foundation
  • coregraphics
  • uikit

2.then need add swift bridging header allows communicate old objective-c classes swift classes.you need 1 if plan keep portions of codebase in objective-c. can create manually in following way:

  1. add new file xcode (file > new > file), select “source” , click “header file“.

  2. name file “yourprojectname-bridging-header.h”.

  3. navigate project build settings , find “swift compiler – code generation” section. may find faster type in “swift compiler” search box narrow down results. note: if don’t have “swift compiler – code generation” section, means don’t have swift classes added project yet. add swift file, try again.

  4. next “objective-c bridging header” need add name/path of header file. if file resides in project’s root folder put name of header file there. examples: “projectname/projectname-bridging-header.h” or “projectname-bridging-header.h”.

  5. open newly created bridging header , import objective-c classes using #import statements. class listed in file able accessed swift classes.

you bridging header must have inside following lines:

#import <uikit/uikit.h> #import <chartboost/chartboost.h> #import <chartboost/cbnewsfeed.h> #import <commoncrypto/commondigest.h> #import <adsupport/adsupport.h> 

you can read more next steps using charboost in ios integration manual.

i hope you.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -