My program has crashed:
#0 0x3138cec0 in objc_msgSend
#1 0x0002bb6e in -[AdMobDelegateWrapper didYouNilOutYourDelegate:]
#2 0x0002c392 in -[AdMobDelegateWrapper publisherId]
#3 0x0001ab7e in -[AdMobAd buildParamsWithLastClickInfo:]
#4 0x0001b044 in -[AdMobAd requestAdFromServer]
#5 0x0001963c in -[AdMobAd browserIconsDidFinishLoading]
#6 0x0001a23e in -[AdMobAd downloadDidSucceed:]
#7 0x323fba14 in -[NSObject performSelector:withObject:]
#8 0x0002122e in -[AdMobURLDownload performRequest:]
#9 0x33731acc in -[NSThread main]
#10 0x336dfd14 in __NSThread__main__
#11 0x33ad8788 in _pthread_body
why?
I use 4.0 SDK and device's system version is iOS 3.1.3.
My codes is very simple that from examples which in "admob_iphone_sdk_20100818".
Ok, I found the solution.
I was almost there but not quite. The problem IS setting the delegate to nil, but the place was wrong.
This is how I solved it:
- (void)viewDidLoad {
[super viewDidLoad];
adMobAd = [AdMobView requestAdWithDelegate:self]; // start a new ad request
[adMobAd retain];
}
- (void)viewDidUnload {
//Nothing to do here
}
- (void)dealloc {
//THIS IS THE IMPORTANT STUFF
if (adMobAd != nil){
adMobAd.delegate = nil;
}
[adMobAd release];
[super dealloc];
}
Moving the "liberation" of the delegate to the dealloc block has fixed the problem for me.
Hope it helps!
Related
I seem to be getting a crash right after doing [[CCDirector sharedDirector] popScene]. I am not really sure why. Any clues would help, thanks!
Crashlog:
#0 0x99e5ef84 in objc_msgSend ()
#1 0x302d543a in __NSFastEnumerationMutationHandler ()
#2 0x00046b46 in -[CCScheduler tick:] (self=0x1919ac0, _cmd=0x7b682, dt=0.0333320014) at /Users/Sup3rpanda/Dev/My Projects/Puzzle/libs/cocos2d/CCScheduler.m:211
#3 0x0001fb52 in -[CCDirector mainLoop] (self=0xf10a30, _cmd=0x76272) at /Users/Sup3rpanda/Dev/My Projects/Puzzle/libs/cocos2d/CCDirector.m:208
#4 0x305355cd in __NSFireTimer ()
#5 0x302454a0 in CFRunLoopRunSpecific ()
#6 0x30244628 in CFRunLoopRunInMode ()
#7 0x32044c31 in GSEventRunModal ()
#8 0x32044cf6 in GSEventRun ()
#9 0x309021ee in UIApplicationMain ()
#10 0x00002e94 in main (argc=1, argv=0xbfffef60) at /Users/Sup3rpanda/Dev/My Projects/Puzzle/main.m:13
Scheduled timer:
tGridTimer = [[CCTimer alloc] initWithTarget: self selector: #selector(gridSlideUpForced2:) interval: sGridSpeed];
[[CCScheduler sharedScheduler] scheduleTimer:tGridTimer];
Bit of CoCos 2d code that appears to be related to crashing:
-(void) tick: (ccTime) dt
{
if( timeScale_ != 1.0f )
dt *= timeScale_;
for( id k in methodsToRemove )
[scheduledMethods removeObject:k];
[methodsToRemove removeAllObjects];
for( id k in methodsToAdd )
[scheduledMethods addObject:k];
[methodsToAdd removeAllObjects];
for( CCTimer *t in scheduledMethods )
impMethod(t, fireSelector, dt);
[[CCScheduler sharedScheduler] scheduleTimer:tGridTimer];
Are you cleaning up your timers in onExit or dealloc in your scene class? Could be the scene still thinks some of the schedulers are still running
I'm coding a game for iphone in c++ and 100% opengl.
I need to add gamecenter to it so to show the UIViews I had to do something hackish.
void sb_socialShowAchievementsView(){
SocialDelegate* del = [[[SocialDelegate alloc] init] autorelease];
GKAchievementViewController *achievements = [[GKAchievementViewController alloc] init];
if (achievements != nil) {
achievements.achievementDelegate = del;
HelperViewController* hvc = [[[HelperViewController alloc] init] autorelease];
[globalGLView addSubview:hvc.view];
[hvc presentModalViewController: achievements animated: YES];
}
[achievements release];
}
SocialDelegate implements protocols GKAchievementViewControllerDelegate and GKLeaderboardViewControllerDelegate.
globalGLView is my EAGLView instance.
and HelperViewController is just a UIViewController subclass.
The problem is when I call sb_socialShowAchievementsView() the app receives a SIGABRT with the following call stack and message:
*** Assertion failure in -[UIButtonLabel setTextColor:], /SourceCache/UIKit_Sim/UIKit-1262.60.3/UILabel.m:312
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: color'
#0 0x98ece156 in __kill
#1 0x98ece148 in kill$UNIX2003
#2 0x98f60899 in raise
#3 0x98f769b8 in abort
#4 0x961a2fda in __gnu_cxx::__verbose_terminate_handler
#5 0x03022333 in _objc_terminate
#6 0x961a117a in __cxxabiv1::__terminate
#7 0x961a11ba in std::terminate
#8 0x961a12b8 in __cxa_throw
#9 0x03022481 in objc_exception_throw
#10 0x02e8b238 in +[NSException raise:format:arguments:]
#11 0x022c6e37 in -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]
#12 0x0052260f in -[UILabel setTextColor:]
#13 0x005ec3d3 in -[UIButton layoutSubviews]
#14 0x002a0481 in -[CALayer layoutSublayers]
#15 0x002a01b1 in CALayerLayoutIfNeeded
#16 0x004bd976 in __-[UINavigationController _positionNavigationBarHidden:edge:]_block_invoke_1
#17 0x0043698f in +[UIView(Animation) _performWithoutAnimation:]
#18 0x004c1e26 in -[UINavigationController _positionNavigationBarHidden:edge:]
#19 0x004bd9ae in -[UINavigationController _positionNavigationBarHidden:]
#20 0x004bc0c3 in -[UINavigationController _updateBarsForCurrentInterfaceOrientation]
#21 0x004b99b1 in -[UIViewController viewDidMoveToWindow:shouldAppearOrDisappear:]
#22 0x004c0bfd in -[UINavigationController viewDidMoveToWindow:shouldAppearOrDisappear:]
#23 0x0044217f in -[UIView(Internal) _didMoveFromWindow:toWindow:]
#24 0x00440d94 in -[UIView(Hierarchy) _postMovedFromSuperview:]
#25 0x00439c30 in -[UIView(Internal) _addSubview:positioned:relativeTo:]
#26 0x00437f83 in -[UIView(Hierarchy) addSubview:]
#27 0x0049355b in -[UITransitionView transition:fromView:toView:]
#28 0x006a3a16 in -[UIWindowController transition:fromViewController:toViewController:target:didEndSelector:]
#29 0x004b710d in -[UIViewController presentModalViewController:withTransition:]
#30 0x0007ee96 in sb_socialShowAchievementsView at social-bindings-iphone.mm:184
I just can't get what am I doing wrong...
I encountered the exact same problem. I have a class that manages all the game center stuff which I wrote a couple of months ago, and it worked fine. I tried to import it to a new project, and called the standard methods to present the GKAchievementViewController, then it crashed with the same SIGABRT as you had. Then I tried authenticating the player first (which I would normally do before calling the achievements controller), and the problem went away. I guess it's a bug in the GameKit framework. I couldn't file a bug report because bug reporter obviously has it's own bugs :)
I have an application which used top bar navigation and a MapView. On the map view I have placed some annotations and when selecting an annotation, pressing the disclosure button to go into a subview and then going back to the MapView using the back button my application crashes. It does not give me any errors.
Can anyone help me figure out why my application keeps crashing?
I have made a short video showing this mysterious crash (because I'm afraid that I do not explain it very well)
The video can be seen on this link http://snuzzer.dk/pub/iPhoneAppMapKitCrash.mov
Please tell me if you need to see any code in order to determine the reason for the crash. I am not sure what code would be necessary for this as I do not get any error.
EDIT: This is the output of my stack trace:
#0 0x01275a63 in objc_msgSend
#1 0x0586c860 in ??
#2 0x0037ef1d in -[UINavigationController setDisappearingViewController:]
#3 0x0037c4f6 in -[UINavigationController _clearLastOperation]
#4 0x0037ce3f in -[UINavigationController navigationTransitionView:didEndTransition:fromView:toView:]
#5 0x00509e23 in -[UINavigationTransitionView _notifyDelegateTransitionDidStopWithContext:]
#6 0x0050afd2 in -[UINavigationTransitionView _cleanupTransition]
#7 0x002f6665 in -[UIViewAnimationState sendDelegateAnimationDidStop:finished:]
#8 0x002f64f7 in -[UIViewAnimationState animationDidStop:finished:]
#9 0x01ffa6cb in run_animation_callbacks
#10 0x01ffa589 in CA::timer_callback
#11 0x010f4fe3 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
#12 0x010f6594 in __CFRunLoopDoTimer
#13 0x01052cc9 in __CFRunLoopRun
#14 0x01052240 in CFRunLoopRunSpecific
#15 0x01052161 in CFRunLoopRunInMode
#16 0x01a48268 in GSEventRunModal
#17 0x01a4832d in GSEventRun
#18 0x002d442e in UIApplicationMain
#19 0x00002918 in main at main.m:14
EDIT: It seems that when I do not release my annotationViewController the application does not crash. I will keep playing with the application to see if this is right. Can anyone tell me if this might be right and if so, why? And when would I release it then?
- (void)mapView:(MKMapView *)aMapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control {
for(MyAnnotation* a in mapView.annotations) { // searching for chosen annotation
if(view.annotation == a) {
// set array from plist
NSString *path = [[NSBundle mainBundle] pathForResource:#"Annotations" ofType:#"plist"];
NSMutableArray* anns = [[NSMutableArray alloc] initWithContentsOfFile:path];
AnnotationDetailViewController *annotationDetailViewController = [[AnnotationDetailViewController alloc] initWithNibName:#"AnnotationDetailViewController" bundle:nil];
annotationDetailViewController.ann = [anns objectAtIndex:[a.annId intValue]];
[self.navigationController pushViewController:annotationDetailViewController animated:YES];
[annotationDetailViewController release]; // this is the one that I think will correct the error
[anns release];
}
}
}
You should look for an ivar in AnnotationDetailViewController that you are under-retaining/over-releasing. I would suspect some UIView, perhaps an IBOutlet that you did not configure to retain, particularly if you also fail to set it to nil in viewDidUnload. I recommend you read Memory Management of Nib Objects if you haven't already.
It's difficult to debug this without the code, or more information about your variables, but that's where I would look given where it's crashing.
i get this error and EXC_BAD_ACESS when i run my maps application... any idea
#0 0x3510741c in objc_msgSend ()
#1 0x30a69364 in -[CLLocationManager onClientEventLocation:] ()
#2 0x30a66960 in -[CLLocationManager onClientEvent:supportInfo:] ()
#3 0x30a66b28 in OnClientEvent ()
#4 0x30a5f860 in CLClientInvokeCallback ()
#5 0x30a633e4 in CLClientHandleDaemonData ()
#6 0x357a902c in __CFMessagePortPerform ()
#7 0x3577be46 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#8 0x3577be04 in __CFRunLoopDoSource1 ()
#9 0x3576e0a4 in __CFRunLoopRun ()
#10 0x3576dd7a in CFRunLoopRunSpecific ()
#11 0x3576dc88 in CFRunLoopRunInMode ()
#12 0x336ace8c in GSEventRunModal ()
#13 0x318f0f94 in -[UIApplication _run] ()
#14 0x318ee4d4 in UIApplicationMain ()
#15 0x0000281c in main (argc=1, argv=0x2ffff5e0) at /Users/abcd/Desktop/wataproject/main.m:14
http://brainwashinc.wordpress.com/2010/01/05/mapkit-crash-getting-user-location/
This helped me solve this issue
#vivianaranha's approach might solve the issue but I believe (after encountering this myself) that you are doing something else bad.
Specifically, in my case I had set mapView.showsUserLocation = YES so under the hood mapView was wiring itself up to the CLLocationManager. The solution was to ensure that I called mapView.showsUserLocation = NO in viewWillDisappear.
Also I discovered that you must have mapView.userTrackingMode set to what you require before you make the call to mapView.showsUserLocation = YES. Putting it all together you end up with something like this:
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.mapView.userTrackingMode = MKUserTrackingModeFollow;
self.mapView.showsUserLocation = YES;
self.mapView.delegate = self;
}
- (void)viewWillDisappear:(BOOL)animated {
self.mapView.userTrackingMode = MKUserTrackingModeNone;
self.mapView.showsUserLocation = NO;
self.mapView.delegate = nil;
[super viewWillDisappear:animated];
}
I see this log in the console when I run my app:
CALayer position contains NaN: [nan -0.5]
The app consists of a UITaBar of which the first tab is a UINavigationController. In the NavController I'm launching the AddressBookPicker. In the AddressBookPicker I'm only choosing to show phone numbers.
When I choose on a contact that has only email addresses, that is when I see this log.
I do not see any crashes or any issues for that matter, just the log printed onto the console. Want to make sure that this is not a hidden issue that crashes on me after the launch.
Below is a snippet of relevant code and the stacktrace. Not sure which other parts of the code to paste here, please let me know if there are any I can post that might help.
Any help/inputs appreciated.
Thanks!
Code
ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
NSArray *displayedItems = [NSArray arrayWithObjects: [NSNumber numberWithInt:kABPersonPhoneProperty]), nil];
picker.displayedProperties = displayedItems;
picker.peoplePickerDelegate = self;
[self presentModalViewController:picker animated:YES];
Stacktrace
#0 0x00096377 in NSLog
#1 0x046b38c9 in CALayerSetPosition
#2 0x046b3846 in -[CALayer setPosition:]
#3 0x046b375f in -[CALayer setFrame:]
#4 0x002f510b in -[UIView(Geometry) setFrame:]
#5 0x003dbe6d in -[UILabel setFrame:]
#6 0x023ed095 in -[ABPersonTableViewDataSource reloadNoValueLabelAnimated:]
#7 0x0244cf53 in -[ABPersonTableViewDataSource reloadDataIncludingHeaderView:invalidatePropertyData:]
#8 0x023f30d4 in -[ABPersonTableViewDataSource reloadDataIncludingHeaderView:]
#9 0x023eabc9 in -[ABPersonViewControllerHelper prepareViewWithDisplayedProperties:person:allowActions:]
#10 0x023ea6bc in -[ABPersonViewControllerHelper loadViewWithDisplayedProperties:person:allowDeletion:allowActions:]
#11 0x023ea598 in -[ABPersonViewController loadView]
#12 0x0036a54f in -[UIViewController view]
#13 0x003689f4 in -[UIViewController contentScrollView]
#14 0x003787e2 in -[UINavigationController _computeAndApplyScrollContentInsetDeltaForViewController:]
#15 0x00376ea3 in -[UINavigationController _layoutViewController:]
#16 0x0037812d in -[UINavigationController _startTransition:fromViewController:toViewController:]
#17 0x00372ccd in -[UINavigationController _startDeferredTransitionIfNeeded]
#18 0x00379d8b in -[UINavigationController pushViewController:transition:forceImmediate:]
#19 0x00372b67 in -[UINavigationController pushViewController:animated:]
#20 0x02403bc2 in -[ABPeoplePickerNavigationController pushViewController:animated:]
#21 0x0242a424 in -[ABPeoplePickerNavigationController showCardForPerson:withMemberCell:animate:forceDisableEditing:personViewController:]
#22 0x0242ce20 in -[ABMembersViewController showCardForPerson:withMemberCell:animate:]
#23 0x0240a0ef in -[ABMembersController abDataSource:selectedPerson:atIndexPath:withMemberCell:animate:]
#24 0x023fdb47 in -[ABMembersDataSource tableView:didSelectRowAtIndexPath:]
#25 0x00333a48 in -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:]
#26 0x0032a32e in -[UITableView _userSelectRowAtIndexPath:]
#27 0x0003f21a in __NSFireDelayedPerform
#28 0x02631f73 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
#29 0x026335b4 in __CFRunLoopDoTimer
#30 0x0258fdd9 in __CFRunLoopRun
#31 0x0258f350 in CFRunLoopRunSpecific
#32 0x0258f271 in CFRunLoopRunInMode
#33 0x02f2f00c in GSEventRunModal
#34 0x02f2f0d1 in GSEventRun
#35 0x002ceaf2 in UIApplicationMain
#36 0x00002554 in main at main.m:14
This seems to now cause crashes in iOS 4.2. Try picking a contact with no phone number, you should go to a view that says No Phone numbers. The crash occurs when you go back to All Contacts then pick that contact again.
Is anyone else experiencing this problem?
edit: In my case, I am only displaying email addresses. Picking a contact without an email address twice causes the crash.
I'm having the same problem, though it doesn't appear to happen in the built in apps (eg. mail).
One slightly hackish workaround is to add the First and Last names to the list of displayed properties - it doesn't show the "no email address" layer in that case, but also doesn't crash.
I had the same problem with "CALayer position contains NaN:". The app was fine in iOS3.x and iOS4.1 devices, but crashed in iOS4.2.
In my case, I has the following code:
CGRect frame;
frame.size.height = kTableCellHeight - 11;
frame.size.width = widthCell - 30;
UILabel *descriptionLabel = [[UILabel alloc] initWithFrame:frame];
The UILabel creation failed and shown that error. In my case, it was solved adding arbitrary values for frame.origin (for this UILabel purpose, it didn't matter)
CGRect frame;
frame.size.height = kTableCellHeight - 11;
frame.size.width = widthCell - 30;
frame.origin.x = 0;
frame.origin.y = 0;
UILabel *descriptionLabel = [[UILabel alloc] initWithFrame:frame];
Maybe the problem with "CALayer position contains NaN" is because some nil, incomplete or undefined value or structure is being used.
I don't know.
I see this too - I am doing something completely different from you - I am using the route-me mapping engine to display scrollable maps.
I believe it has something to do with scrolling views - and a layer somehow involved in the scrolling. As some of the views you mentioned I believe are scrolling - this would concur with my observations.
I wish I had more data for you, but one thing I can tell you is that I have been working on the app for months, and have been testing it on the iPhone and iPad, devices and simulator, under OSes 3.2 and 4.0 - and have had no crashes or memory leaks [at all, or associated with this].
So in short - no idea - but I think you're okay!