Xcode4.0 미만일때와 xcode4.0이상일때는 방법이 조금 틀리다는것을 알수 있을것입니다. 
xcode4.0미만일때는 각 이미지나 각 InfoPlist.strings 의 Get Info 의 정보 들이 마우스 우 클릭으로
보여 지지만 Xcode4.0이상일때는 Get Info가 없는 상태 입니다.

 위 이미지에서 보듯이View 에서 오른쪽 세번째 버튼이 Get Info와 똑같습니다. !!
그런 후에 Localization 으로 각 지역을 추가 해주시면 InfoPlist.strings에 각 지역별로 생깁니다.

각 지역별로 생긴 후에 

CFBundleDisplayName  ="네모로직";

CFBundleDisplayName  ="NemoLogic";

각 지역별로 위와 같이 쓰면 끝납니다. ^^ 이상입니다. !! 궁금한점이 있으시면 댓글 달아 주세요 !!!!

 

 

NSString - > NSData

NSString *temp = [[NSString alloc] initWithData:tempData encoding:NSUTF8StringEncoding];

[temp release];



NSData - > NSString

NSData *temp = [tempNSString dataUsingEncoding:NSUTF8StringEncoding];


이상입니다..!!!!

위와 같은 오류 현상이 날때를 볼수가 있을 것이다.
그런데 Xcode 4.0이번 버젼과 이후 버젼에서 이 Warning를 수정 하는 방법이 틀리다.

이전 버젼

1) Info.plist 파일의 Get Info 창을 열고 targets 탭을 클릭해서 프로젝트이름 앞에 체크를 푼다.

2) Groups & Files 창에서 Targets 항목 아래의 프로젝트 명 아래에서 Copy Bundle Resources 아래에 Info.plist가 있는지 확인한다. (있다면 삭제)

검색 하면 이 방법은 많이 나와 있을 것이다.


이후 버젼

1)프로젝트 정보 창에서 TARGETS 에서 BuildPhases 에서 Copy Bundle Resources 아래에 있는
Info.plist 를 지운다.

-----------------------------------------------------------------------------------
Xcode4.0이후에 바뀐 부분이 너무 많다 ㅠㅠ 복잡하네요 ..~!


NSLog(@"%@",[[UIDevice currentDevice] model];

아이폰이면 iPhone 아이팟이면 iPod로 됩니다.

iOS3.2이상에서만 됩니다. 참고 하세요..!!

NSString* deviceInfo = [[UIDevice currentDevice] model];

if([deviceInfo isEqualToString:@"iPhone"])
              NSLog(@"이건 아이폰입니다. !!!!");
else
              NSLog(@"현재 아이폰이 아닙니다. !!!");


이렇게 하면 되겠네요 ^^

char* -> NSString

char szText[] = "hi...";
NSString* nsStr = [NSString stringWithUTF8String: szText];

char strDocumentDirectory[1024];
[pDocumentsDirectory getCString:strDocumentDirectory maxLength:sizeof(strDocumentDirectory)-1 encoding:NSASCIIStringEncoding];

NSString -> char*

NSString* nsStr = @"hi I'm NSString";
const char* strTmp = [nsStr UTF8String];



---------------------------------------------------------------
출처]http://manwooo.egloos.com/834519

iPhone: Determining Available Memory

The iPhone has limited memory, and even simple applications can easily trigger a low memory warning. If you've implemented caching for performance reasons, you'll often find yourself balancing memory consumption against user experience.

Measuring the current available RAM allows one to make pre-emptive decisions about memory utilization before a low memory warning is triggered, possibly avoiding overly broad cache evictions when a memory warning is triggered.

I've seen this question come up a number of times, so here's a brief code snippet demonstrating how to determine available memory from the Mach VM statistics.

#import <mach/mach.h>
#import <mach/mach_host.h>
 
static void print_free_memory () {
    mach_port_t host_port;
    mach_msg_type_number_t host_size;
    vm_size_t pagesize;
    
    host_port = mach_host_self();
    host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t);
    host_page_size(host_port, &pagesize);        
 
    vm_statistics_data_t vm_stat;
              
    if (host_statistics(host_port, HOST_VM_INFO, (host_info_t)&vm_stat, &host_size) != KERN_SUCCESS)
        NSLog(@"Failed to fetch vm statistics");
 
    /* Stats in bytes */ 
    natural_t mem_used = (vm_stat.active_count +
                          vm_stat.inactive_count +
                          vm_stat.wire_count) * pagesize;
    natural_t mem_free = vm_stat.free_count * pagesize;
    natural_t mem_total = mem_used + mem_free;
    NSLog(@"used: %u free: %u total: %u", mem_used, mem_free, mem_total);
}
 
 
출처
http://landonf.bikemonkey.org/code/iphone/Determining_Available_Memory.20081203.html

========================================= 국가 설정 값 =====================================

NSLocale *locale = [NSLocale currentLocale];
NSString* conCode = [locale objectForKey:NSLocaleCountryCode];
NSString* conName = [locale displayNameForKey:NSLocaleCountryCode value:conCode];

국가 리전 코드 값은
http://lifehack.kr/90095666575

참고 하시면 됩니다.!!!! 뒤에 큰 대문자들입니다 ^^

========================================== 언어 설정 값 =====================================

NSUserDefaults* defs = [NSUserDefaults standardUserDefaults];
NSArray* languages = [defs objectForKey:@"AppleLanguages"];
NSString* currentLanguage = [languages objectAtIndex:0];

입니다 ^^

예를 들자면..

if([currentLanguage usEqualToString:@"ko"])
{
     ******
}
else
{
   ********
}

이런씩으로 하면 되겠네요 ^^

먼저 iAd.framework 를 추가 하는 부분은 인터넷에서 많이 찾아 볼수 있는 정보 이니 생략 하겠습니다.

2주 전만 해도 정보가 많이 부족 했는데 최근 들어서 iAd관련 하여 정보가 많이 올라 오고 있는것으로 보입니다.

아직까지 미국에서만 된다니 한국에서는 테스트 조차도 못해보는 ㅠㅠ

일반 게임을 만들시에 많은 분들이 cocos2D를 많이 사용 하시는 분들이 계신다 

그 분들을 위해서 cocos2D에서 iAd를 사용 하는법을 잠시 적겠습니다.

cocos2D를 사용 하여 임시적으로 하나의 프로젝트를 생성 합니다.

일반 프로젝트를 생성 하면 나오는 Hello World 프로젝트 입니다. 밑에 부분은 많이 봤을 것입니다.

if( (self=[super init] )) 

{

//cocos2D는 Layer이나 Scene이나 Node를 상속 받아서 사용 합니다.

//View단에서 움직이는 부분이 없으므로 

//ViewController를 동적 생성 해줍니다.

//ADBannerView도 역시 동적 생성 해줍니다.

UIViewController *controller = [[UIViewController alloc]init];   //동적 생성.

controller.view.frame = CGRectMake(0,0,480,320);                 //Hello World가로 방향 

ADBannerView *adView = [[ADBannerView alloc] initWithFrame:CGRectZero];

adView.requiredContentSizeIdentifiers  =                      [NSSet setWithObject:ADBannerContentSizeIdentifier480x32];

adView.currentContentSizeIdentifier = ADBannerContentSizeIdentifier480x32;//ADBannerContentSizeIdentifier480*32;

       [controller.view addSubview:adView];    //View 위에 배너를 add하시면 됩니다.

       [[[CCDirector sharedDirector] openGLView] addSubview:controller.view];

// create and initialize a Label

        CCLabel* label = [CCLabel labelWithString:@"Hello World" fontName:@"Marker Felt"                        fontSize:64];


// ask director the the window size

CGSize size = [[CCDirector sharedDirector] winSize];

// position the label on the center of the screen

label.positionccp( size.width /2 , size.height/2 );

// add the label as a child to this Layer

[self addChild: label];

}

////////////*지금 View 및 Banner 두개다 동적할당을 하였기 때문에 delloc 에서 release를 잊으시면 안될꺼 같아 보입니다.  *

//======================================================================================
일반 프로젝트의 Banner추가 방법 입니다. cocos2D를 사용 하지 않았으므로 View위에서 실행 될것으로 압니다.

ADBannerView *adView = [[ADBannerView alloc] initWithFrame:CGRectZero];

adView.requiredContentSizeIdentifiers = [NSSet setWithObject:ADBannerContentSizeIdentifier320x50];

//adView.delegate = self;

adView.frame = CGRectMake(0,430,320,50);

[self addSubview:adView];


//========================================================================================
이 부분도 release를 꼭 해주어야 할꺼 같네요.. ^^ 이상 입니다..~!~!~!

// 빈 문자열 생성하기
NSString *str1 = [NSString new];


//일반적인 문자열 대입 - 문자열 상수

str1 = @"web2log.com";


//포멧 문자열(stringWithFormat) - 변수 대입방식
NSString *str2 = [NSString stringWithFormat:@"Hi, %@",str1];


//포멧 문자열(stringWithFormat) - 숫자 대입방식

NSString *str3 = [NSString stringWithFormat:@"Integer, %d",123456];


//포멧 문자열(stringWithFormat) - 문자열 대입방식

NSString *str4 = [NSString stringWithFormat:@"stringWithFormat, %s","web2log.com"];


//Object-C형식 문자열

NSString *str5 = [NSString stringWithString:@"web2log.com"];  


//C형식 문자열

NSString *str6 = [NSString stringWithCString:"web2log.com"];


//문자열 Append (추가)

NSString *str7 = [str6 stringByAppendingString:@":web2log.com"];


//문자열 길이 구하기

int len = [str7 length];


//String형을 int형으로 형변환하기

int vInt = [@"1234" intValue];


//String형을 float형으로 형변환하기

float vFloat = [@"1234.56" floatValue];


//메모리 할당한 문자열 변수 제거

[str1 release];


------------------------------------------------
참고]http://web2log.com/38


NSString를 int로 변환 하는 방법.


NSString *nStr;
nStr = @"16";
int j = [nStr intValue];



int를 NSString로 변환 하는 방법.

int j = 0;
NSString *nStr = [NSString stringWithFormat:@"%d",j];


=======================================================================


+ Recent posts