简体   繁体   中英

iOS Application crashes when using Admob

I am currently trying to integrate my admob code into my application. But somehow the application crashes during launch without any output in the console. EXC_BAD_ACCESS. But I figured that the application crashes once it executes the following line from admob sdk.

// Initiate a generic request to load it with an ad.
[bannerView_ loadRequest:[GADRequest request]];

Since I do not get any output from the console, i did a 'bt' from the gdb and got the following output.

(gdb) bt
#0 0x00057005 in undo ()
#1 0x0001864e in -[GADCachedFile fileModificationDate] (self=0x735fe70, _cmd=0x3c902) at /Volumes/BuildData/pulse-data/recipes/88221850/base/branches/googleads_nextgen_iphone_release_branch/googlemac/iPhone/GoogleAds/NextGen/Network/GADCachedFile.m:72
#2 0x000189f6 in -[GADCachedFile beginFetchWithCacheBuster:] (self=0x735fe70, _cmd=0x3c88d, cacheBuster=0 '\000') at /Volumes/BuildData/pulse-data/recipes/88221850/base/branches/googleads_nextgen_iphone_release_branch/googlemac/iPhone/GoogleAds/NextGen/Network/GADCachedFile.m:133
#3 0x000182fa in -[GADCachedFile validate] (self=0x735fe70, _cmd=0x3b104) at /Volumes/BuildData/pulse-data/recipes/88221850/base/branches/googleads_nextgen_iphone_release_branch/googlemac/iPhone/GoogleAds/NextGen/Network/GADCachedFile.m:156
#4 0x0002b51a in -[GADObjectPrivate ensureSupportFiles] (self=0x8838bd0, _cmd=0x3aad7) at /Volumes/BuildData/pulse-data/recipes/88221850/base/branches/googleads_nextgen_iphone_release_branch/googlemac/iPhone/GoogleAds/NextGen/Object/GADObjectPrivate.m:256
#5 0x0002abc4 in -[GADObjectPrivate loadRequest:] (self=0x8838bd0, _cmd=0x34a1e, request=0x735e930) at /Volumes/BuildData/pulse-data/recipes/88221850/base/branches/googleads_nextgen_iphone_release_branch/googlemac/iPhone/GoogleAds/NextGen/Object/GADObjectPrivate.m:715
#6 0x00007c8b in -[TwitUpdateViewController viewDidLoad] (self=0x732f020, _cmd=0x35c00) at /Users/ram/Documents/Tweet 2/Classes/TwitUpdateViewController.m:635
#7 0x006c05ca in -[UIViewController view] ()
#8 0x00002ea3 in -[TwitUpdateAppDelegate applicationDidFinishLaunching:] (self=0x8837520, _cmd=0x2080ecb, application=0x8809870) at /Users/ram/Documents/Tweet 2/Classes/TwitUpdateAppDelegate.m:48
#9 0x00616f80 in -[UIApplication _callInitializationDelegatesForURLayload:suspend ed:] ()
#10 0x006193b0 in -[UIApplication _runWithURLayload:launchOrientation:statusBarSty le:statusBarHidden:] ()
#11 0x006233ec in -[UIApplication handleEvent:withNewEvent:] ()
#12 0x0061bb3c in -[UIApplication sendEvent:] ()
#13 0x006209bf in _UIApplicationHandleEvent ()
#14 0x034d2822 in PurpleEventCallback ()
#15 0x02aa9ff4 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FU NCTION__ ()
#16 0x02a0a807 in __CFRunLoopDoSource1 ()
#17 0x02a07a93 in __CFRunLoopRun ()
#18 0x02a07350 in CFRunLoopRunSpecific ()
#19 0x02a07271 in CFRunLoopRunInMode ()
#20 0x00618c6d in -[UIApplication _run] ()
#21 0x00624af2 in UIApplicationMain ()
#22 0x00002c20 in main (argc=1, argv=0xbffff0a4) at /Users/ram/Documents/Tweet 2/main.m:14

Can anyone tell me whats the problem here? I tried the code with my other applications and none had a problem executing the admob sdk. It would be great if someone could help me on this. I am trying very hard for the past few days and I can't figure out where's the problem. I even tried to run it using Instruments and NSZombieEnabled , somehow I think the problem is due to [GADCachedFile fileModificationDate] which I am not sure where this is called from Admob SDK

I was just having this clueless crash while calling that exact code in my app. Tried a few things and it didn't work, so I checked my Project Build Settings.

Under "Targets", search for the "Library Search Paths" and then I found a couple of old folders of old ads library indicated in there (I used them in previous version of my app but now decided to remove them, and so all the files are not linked to my project, but they are still there). So what I did was just delete all the unrelated directory listing in there. Did a clean all and rerun and it does not crash anymore.

Not sure my problem is similar to yours or not, but I thought I'd share this.

Good luck.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM