2011-04-21 4 views
0

하나는 일 단계 (35), MEM이내 코드에 문제가 있습니까? 내 응용 프로그램의

35 MyAppName       0x00002c60 0x1000 + 7264 

0x00002c60 그래서 나는 다음과 같이 충돌 지점의 위치를 ​​명령 ATOS라는 주소, thread0에서 추락 :

atos -arch armv6 -o MyAppName.app/MyAppName 0x00002c60 

을 반환합니다
-[AppDelegate setGPictureArray1:] (in MyAppName) (AppDelegate.m:9) 

나는 모든 코드를 선으로 표시하기 전에

//AppDelegate.h 
#import <UIKit/UIKit.h> 
#import "RootViewController.h" 
@class RootViewController; 
@interface AppDelegate : NSObject <UIApplicationDelegate> { 
    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; 

문제가 있음을 발견했습니다. 의견을 환영합니다.

+0

문제입니다. –

답변

0

나는 그 속성을 설정하려는 값이 잘못된 포인터 (할당되지 않은 인스턴스를 가리키고 있음)이거나 기존 값이 유효하지 않다고 생각합니다.

-(void)setGPictureArray1:(NSMutableArray*)array 
{ 
    [gPictureArray1 release]; 
    gPictureArray1 = array; 
    [gPictureArray1 retain]; 
} 

가 호출 될 때마다 "배열"의 값을 확인하고 "gPictureArray1 :

그래서 당신은 세터를 호출 누가 추적 할 수 있습니다 구현 파일에 다음 함수를 만들고 그 안에 중단 점을 넣어 "그것이 유효한 무언가를 가리키고 있는지 확인하십시오. 그것이 너무 여러 번 호출 될 경우 당신은 또한 NSZombies을 사용할 수 있습니다 : 당신이`gPictureArray1`을 설정하는 혹은 당신이에 설정하는 어떤 곳

http://www.cocoadev.com/index.pl?NSZombieEnabled

+0

당신이 말한대로했는데 오류가 없습니다 – monsabre

+0

이 충돌 파일은 Apple Rejection Email로 반환되었습니다. 하지만이 앱은 내 ipad (os4.3.2, os 3.0, 4.2, 3.31 배포 대상) 및 ipod (os 3.1.3, os 3.0, 3.1.3 배포 대상)에서 잘 작동하지만 Apple appstore review에서 시작하면 충돌이 발생합니다. 기기 (OS 4.3.1)에서 기기의 충돌을 복제 할 수 없습니다. – monsabre

관련 문제