One of my app worked and crashed at thread0, step 35, mem address 0x00002c60
35 MyAppName 0x00002c60 0x1000 + 7264
So I called command atos to locate the crash point as below:
atos -arch armv6 -o MyAppName.app/MyAppName 0x00002c60
it returns
-[AppDelegate setGPictureArray1:] (in MyAppName) (AppDelegate.m:9)
I show all codes before the line
//AppDelegate.h
#import <UIKit/UIKit.h>
#import "RootViewController.h"
@class RootViewController;
@interface AppDelegate : NSObject <UIAppli开发者_如何转开发cationDelegate> {
UIWindow *window;
IBOutlet RootViewController *rootViewController;
NSMutableArray * gPictureArray1;
NSMutableArray * gPictureArray2;
}
@property (nonatomic, retain) NSMutableArray * gPictureArray1;
@property (nonatomic, retain) NSMutableArray * gPictureArray2;
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) RootViewController *rootViewController;
@end
//AppDelegate.m
#import "AppDelegate.h"
#import "RootViewController.h"
@implementation AppDelegate
@synthesize window;
@synthesize rootViewController;
@synthesize gPictureArray1;//**it looks like the crash happens here**
@synthesize gPictureArray2;
I can find there is any problem. Welcome any comment.
I would guess that either the value you are trying to set that property as is an invalid pointer (pointing to a deallocated instance) or that the existing value is invalid.
Create the following function in the implementation file and put a breakpoint in it so you can track who is calling the setter:
-(void)setGPictureArray1:(NSMutableArray*)array
{
[gPictureArray1 release];
gPictureArray1 = array;
[gPictureArray1 retain];
}
Each time it is called check the value of "array" and "gPictureArray1" to make sure it is pointing to something valid. If it is called too many times you can also use NSZombies:
http://www.cocoadev.com/index.pl?NSZombieEnabled
精彩评论