본문 바로가기
모바일 개발/iOS

Cocos2d | 트러블 슈팅

by KISCH 2020. 2. 20.
반응형


코코스



Apple Mach-O Linker Error

DerivedData 폴더 제거

Valid Architecture 에서 armv7s 제거


Application windows are expected to have a root view controller at the end of application launch
Application windows are expected to have a root view controller at the end of application launch
window.rootViewController = rootViewController; // 추가
[window addSubview:[rootViewController view]];
[window makeKeyAndVisible];



cocos2d uniqueldentifier is deprecated

CLScoreServerRequest.m 에서


NSString *device = @"";

if( flags & kQueryFlagByDevice )

 device = [[UIDevice currentDeviceuniqueIdentifier]; 를 주석처리


CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault);

NSString *device=(NSString *)CFUUIDCreateString(kCFAllocatorDefault, uuid); 추가


CLScoreServerPost.m 에서

[self addValue:[[UIDevice currentDeviceuniqueIdentifierkey:@"cc_device_id"]; 를 주석처리


CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault);

NSString *device=(NSString *)CFUUIDCreateString(kCFAllocatorDefault, uuid);

[self addValue:device key:@"cc_device_id"]; 추가



@property, @synthesize 한 전역변수 dealloc시 bad exc error 나는 경우

-> 대부분 에러나는 이유가 addchild할 때, self. 으로 child하지 않았기 때문에, 접근 오류가 난다.



removeChildByTag: child not found

CCMenuItemToggle 사용시

CCMenuItem.m 에서

-(void)setSelectedIndex:(NSUInteger)index

{

if( index != selectedIndex_ ) {

selectedIndex_=index;

[self removeChildByTag:kCurrentItem cleanup:NO];


CCMenuItem *item = [subItems_ objectAtIndex:selectedIndex_];

[self addChild:item z:0 tag:kCurrentItem];


CGSize s = [item contentSize];

[self setContentSize: s];

item.position = ccp( s.width/2, s.height/2 );

}

}

// 수정

-(void)setSelectedIndex:(NSUInteger)index

{

if( index != selectedIndex_ ) {

if (selectedIndex_ != UINT_MAX) {

[self removeChildByTag:kCurrentItem cleanup:NO];

}

selectedIndex_=index;

//[self removeChildByTag:kCurrentItem cleanup:NO];


CCMenuItem *item = [subItems_ objectAtIndex:selectedIndex_];

[self addChild:item z:0 tag:kCurrentItem];


CGSize s = [item contentSize];

[self setContentSize: s];

item.position = ccp( s.width/2, s.height/2 );

}

}


메모리 문제

1. [[CCDirector sharedDirectorrelease]; -> [[CCDirector sharedDirectorend];

2. Incorrect decrement of the reference count of an object that is not owned at this point by the caller -> 레퍼런스 카운트를 감소 시켜야할 의무가 없다



세로모드 고정

RootViewController.m 에서 

- (BOOL)shouldAutorotateToInterfaceOrientation:

UIInterfaceOrientation)interfaceOrientation 

함수의 리턴값을

return














반응형

'모바일 개발 > iOS' 카테고리의 다른 글

Xcode | 디버깅과 트러블 슈팅  (0) 2020.02.27
Xcode | 빌드  (0) 2020.02.27
Xcode | 개발  (0) 2020.02.27
Xcode | 설치 및 환경설정  (0) 2020.02.21
Cocos2d | 기타 클래스  (0) 2020.02.20
Cocos2d | CCAction 클래스  (0) 2020.02.20
Cocos2d | 이미지 관련 클래스  (0) 2020.02.20
Cocos2d | CCNode 클래스  (0) 2020.02.20

댓글