Chartboost integration issues with XCode 6.1

空扰寡人 提交于 2020-01-11 10:27:57

问题


I integrated Chartboost in Xcode 6.0 in the same project and it was working fine but as I updated my Xcode to Xcode 6.1 the bridging header file is not able to compile successfully.

I have added Chartboost framework in my project and added these required frameworks as mentioned in guide.

StoreKit

Foundation

CoreGraphics

UIKit

I added these lines in my bridging header file

import Chartboost/Chartboost.h

import Chartboost/CBNewsfeed.h

import CommonCrypto/CommonDigest.h

import AdSupport/AdSupport.h

Now when I try to build my project the Xcode gives me hell lot of swift compiler errors.

Here are the errors I am getting...

/Users/myprojectBridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:16:42: error: function definition is not allowed here
typedef NS_ENUM(NSUInteger, CBFramework) {
                                         ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:33:42: error: function definition is not allowed here
typedef NS_ENUM(NSUInteger, CBLoadError) {
                                         ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:62:43: error: function definition is not allowed here
typedef NS_ENUM(NSUInteger, CBClickError) {
                                          ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:87:9: error: unknown type name 'NSString'
typedef NSString * const CBLocation;
        ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:135:25: error: cannot find interface declaration for 'NSObject', superclass of 'Chartboost'
@interface Chartboost : NSObject
                        ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:153:25: error: expected a type
+ (void)startWithAppId:(NSString*)appId
                        ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:154:25: error: expected a type
          appSignature:(NSString*)appSignature
                        ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:169:4: error: expected a type
+ (BOOL)hasInterstitial:(CBLocation)location;
   ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:198:4: error: expected a type
+ (BOOL)hasMoreApps:(CBLocation)location;
   ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:229:23: error: expected a type
+ (void)showMoreApps:(UIViewController *)viewController
                      ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:244:4: error: expected a type
+ (BOOL)hasRewardedVideo:(CBLocation)location;
   ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:274:25: error: expected a type
+ (void)didPassAgeGate:(BOOL)pass;
                        ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:290:4: error: expected a type
+ (BOOL)handleOpenURL:(NSURL *)url
   ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:290:24: error: expected a type
+ (BOOL)handleOpenURL:(NSURL *)url
                       ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:291:24: error: expected a type
    sourceApplication:(NSString *)sourceApplication;
                       ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:309:4: error: expected a type
+ (BOOL)handleOpenURL:(NSURL *)url
   ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:309:24: error: expected a type
+ (BOOL)handleOpenURL:(NSURL *)url
                       ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:310:24: error: expected a type
    sourceApplication:(NSString *)sourceApplication
                       ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:322:22: error: expected a type
+ (void)setCustomId:(NSString *)customId;
                     ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:333:4: error: expected a type
+ (NSString *)getCustomId;
   ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:344:23: error: expected a type
+ (void)setFramework:(CBFramework)framework;
                      ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:358:54: error: expected a type
+ (void)setShouldRequestInterstitialsInFirstSession:(BOOL)shouldRequest;
                                                     ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:370:45: error: expected a type
+ (void)setShouldPauseClickForConfirmation:(BOOL)shouldPause;
                                            ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:384:49: error: expected a type
+ (void)setShouldDisplayLoadingViewForMoreApps:(BOOL)shouldDisplay;
                                                ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:396:40: error: expected a type
+ (void)setShouldPrefetchVideoContent:(BOOL)shouldPrefetch;
                                       ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:446:26: error: expected a type
+ (void)setAutoCacheAds:(BOOL)shouldCache;
                         ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:458:4: error: expected a type
+ (BOOL)getAutoCacheAds;
   ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:474:31: error: cannot find protocol declaration for 'NSObject'
@protocol ChartboostDelegate 
                              ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:496:4: error: expected a type
- (BOOL)shouldRequestInterstitial:(CBLocation)location;
   ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:513:4: error: expected a type
- (BOOL)shouldDisplayInterstitial:(CBLocation)location;
   ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:551:36: error: expected a type
                        withError:(CBLoadError)error;
                                   ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:565:31: error: expected a type
                   withError:(CBClickError)error;
                              ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:615:4: error: expected a type
- (BOOL)shouldDisplayMoreApps:(CBLocation)location;
   ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:686:32: error: expected a type
                    withError:(CBLoadError)error;
                               ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:705:4: error: expected a type
- (BOOL)shouldDisplayRewardedVideo:(CBLocation)location;
   ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:743:37: error: expected a type
                         withError:(CBLoadError)error;
                                    ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:818:30: error: expected a type
                  withError:(CBLoadError)error;
                             ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:867:4: error: expected a type
- (BOOL)shouldDisplayMoreApps __attribute__((deprecated("As of version 4.5, use shouldDisplayMoreApps:(CBLocation)location")));;
   ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:22:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/Chartboost.h:937:32: error: expected a type
- (void)didFailToLoadMoreApps:(CBLoadError)error __attribute__((deprecated("As of version 4.5, use didFailToLoadMoreApps:(CBLoadError)error forLocation:(CBLocation)location")));
                               ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:23:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:23:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/CBNewsfeed.h:24:25: error: cannot find interface declaration for 'NSObject', superclass of 'CBNewsfeed'
@interface CBNewsfeed : NSObject
                        ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:23:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:23:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/CBNewsfeed.h:53:4: error: expected a type
+ (NSArray *)getMessages;
   ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:23:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:23:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/CBNewsfeed.h:66:26: error: expected a type
+ (CBStory *)getMessage:(NSString *)messageId;
                         ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:23:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:23:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/CBNewsfeed.h:78:4: error: expected a type
+ (NSUInteger)messageCount;
   ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:23:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:23:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/CBNewsfeed.h:89:4: error: expected a type
+ (NSUInteger)unreadMessageCount;
   ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:23:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:23:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/CBNewsfeed.h:113:4: error: expected a type
+ (BOOL)isNewsfeedUIVisible;
   ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:23:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:23:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/CBNewsfeed.h:139:4: error: expected a type
+ (BOOL)isNotificationUIVisible;
   ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:23:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:23:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/CBNewsfeed.h:180:23: error: expected a type
+ (void)setFetchTime:(NSUInteger)fetchTime;
                      ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:23:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:23:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/CBNewsfeed.h:203:50: error: expected a type
+ (void)setShouldPauseStoryClickForConfirmation:(BOOL)shouldPause;
                                                 ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:23:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:23:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/CBNewsfeed.h:216:25: error: expected a type
+ (void)didPassAgeGate:(BOOL)pass;
                        ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:23:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:23:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/CBNewsfeed.h:232:31: error: cannot find protocol declaration for 'NSObject'
@protocol CBNewsfeedDelegate 
                              ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:23:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:23:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/CBNewsfeed.h:295:28: error: expected a type
- (void)didGetNewMessages:(NSArray *)messages;
                           ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:23:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:23:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/CBNewsfeed.h:319:36: error: expected a type
- (void)didFailToRetrieveMessages:(NSError *)error;
                                   ^
/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:23:9: note: in file included from /Users/bewakoofmac/Desktop/myproject/Bridging-Header.h:23:
import 
        ^
/Users/bewakoofmac/Desktop/myproject/Chartboost.framework/Headers/CBNewsfeed.h:340:4: error: expected a type
- (BOOL)shouldAutomaticallyDisplayNotificationUI:(CBStory *)message;
   ^
:0: error: failed to import bridging header '/Users/bewakoofmac/Desktop/myproject/Bridging-Header.h'

回答1:


EXPLANATION:

It seems like some pods and libraries don't bother importing the basic frameworks as they expect your code to already have them. This doesn't work with Swift as the way to import frameworks changed. All you need to do is to add the frameworks needed in your bridging header file.

ANSWER:

In your specific case, it is complaining about NSObject, NSString, etc... so you need to add #import <Foundation/Foundation.h> in your bridging header file.

In my case, it complained about UIView so I added UIKit.



来源:https://stackoverflow.com/questions/26961687/chartboost-integration-issues-with-xcode-6-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!