Question

Here is code:

Chartboost *cb = [Chartboost sharedChartboost];
cb.delegate = self;
cb.appId = CHARTBOOST_APPID;
cb.appSignature = CHARTBOOST_APPSIGNATURE;

[cb startSession];
[cb cacheInterstitial];

This works fine in iOS6 device but crashes in iOS5.

Crash Log:

NSInvalidArgumentException Reason: -[__NSCFDictionary setObject:forKeyedSubscript:]: unrecognized selector sent to instance 0x1234sva8

How can I solve this problem? Already I made AdSupport.framework optional.

Was it helpful?

Solution

I don't know Chartboost, but the error message indicates that the code makes use of the modern "NSDictionary and NSArray subscripting" feature, e.g.

dict[@"key"] // instead of [dict objectForKey:@"key"]

According to the "Objective-C Feature Availability Index", NSDictionary and NSArray subscripting requires the iOS 6.0 or later SDK and the LLVM Compiler 4.0. It deploys to iOS 5 and later.

So if you don't need the iOS 4.3 compatibility, setting the deployment target to iOS 5 and compiling against the iOS 6 SDK should solve the problem. Make sure that "Apple LLVM compiler" and not "LLVM GCC" or similar is set as compiler in the build settings.

OTHER TIPS

Crash Fixed!

I followed solution in this post: http://forums.xamarin.com/discussion/3893/chartboost-ios-binding-works-on-ios-6-but-crashes-on-ios-5

Just I added lib arclite.a to my project and fixed crash.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top