iphone - iAd Crashing in 3.2 -


i'm noticing iad causing crash on ios 3.2. weak linking in build settings. crashes in createadbanner method

nsstring *contentsize;  if (&adbannercontentsizeidentifierportrait != nil) {     contentsize = uiinterfaceorientationisportrait(self.interfaceorientation) ? adbannercontentsizeidentifierportrait : adbannercontentsizeidentifierlandscape; } else {     contentsize = uiinterfaceorientationisportrait(self.interfaceorientation) ? adbannercontentsizeidentifier320x50 : adbannercontentsizeidentifier480x32; } 

here error comes up.

this gdb configured "x86_64-apple-darwin".sharedlibrary apply-load-rules         attaching process 4681.         assertion failed: (cls), function getname, file /sourcecache/objc4_sim/objc4-427.1.1/runtime/objc-runtime-new.m, line 3939.         assertion failed: (cls), function getname, file /sourcecache/objc4_sim/objc4-427.1.1/runtime/objc-runtime-new.m, line 3939.         current language:  auto; objective-c         (gdb) 

i thought able run iads on 3.2 if weak linked. ideas or suggestions?

aside weak-linking, must check if ad classes available on device. so, can use following test existence of class:

class adclass = nsclassfromstring(@"adbannerview");  if(adclass){   //ads available optionally show them }else{   // ads not available  } 

to check particular method, use this:

bool methodexists = [someobject respondstoselector:@selector(selectortotestname:)];  if(methodexists){    //safe call selector }else{    //the selector doesn't exist in version of ios.  } 

you use above statement, "inlining" boolean check:

if([someobject respondstoselector:@selector(selectortotestname:)]){    //safe call selector }else{    //the selector doesn't exist in version of ios.  } 

Comments