으앍 - 예전부터 늘 부딪혀왔던 문제를 오늘에서야 명확히 정의내리고 싶어서 뒤적뒤적 구글링을 했다.
항상 appdelegate 에서의 시작이 꼬였는데,
바로 window variable서였다.
사실은 이 기본이 되는 문제를 이해하지 못했기 때문에 다른 곳에서도 많이 오류를 범했었더랬지.

1. @synthesize window = _window
변수를 property 로 선언하고 @synthesize 를 구현해서 getter/setter 가 생성하면 외부에서 변수명만으로 값에 접근할 수 있다. 그런데 여기서!! window = _window 라고 별칭을 지어 사용을 하더라.
처음엔 변수명 있는데 이걸 왜 굳이 꼭 붙여서 사용해야 하나 싶었다.

2. [window makeKeyAndVisible];
1번처럼 선언하고 위와 같은 코드를 생성하면 fail!!!!!
why!!!!!!!!!!!!!
왜냐하면 window라는 인스턴스 변수는 존재하지 않는다고 인식하기 때문!!
window=_window 라고 선언해두면
_window 가 인스턴스 변수로 사용되고
window 변수를 private 으로 간주해서 subclass 에서의 접근이 불가능하게 되는 것.
window에 직접 접근하기 위해서는 접근자 메소드 self. 를 사용해서 => self.window 를 사용해야 한다.

3. [_window makeKeyAndVisible];
_window 변수는 접근 할 수 있다.

4. [self.window makeKeyAndVisible]; 
접근자 메소드를 사용해서 이 문장도 avaliable 하다.

@property @synthesize 기능은 참 헷갈리는구나 - 매번 정리해도 까먹고 또 까먹고
맨날 먹기만 하니 이렇게 살이... 읭?
일단 정리해두었으니 다음번엔 다른 기능을 또 추가해볼까낫?
if nsurl has url scheme like as "http://" , use [url absoluteURL];
 else, use [url relativeString]; 


if URL has korean, use stringByAddingPercentEscapesUsingEncoding:
 

webVC.urlString = [[result objectForKey:@"url"] // NSString
stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; 


double click on filename what you want to change in compoile sources
and write "-fno-objc-arc" in textbox
that's all.
They are for Mac OS.
1. Coda
- It is convenient to edit.

2. jEdit
- It can save html file in utf-8.
 
1. Sencha Touch (http://www.sencha.com/)

2.  JQTouch (http://www.jqtouch.com/)

3.  Phonegap (http://www.phonegap.com/)
- 모바일 크로스 플랫폼
- 오픈소스 개발

4.  iWebKit (http://snippetspace.com/)
NSString * tokenAsString = [[[deviceToken description] 
stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]] 
stringByReplacingOccurrencesOfString:@" " withString:@""];
탭뷰 형태의 툴바에 버튼을 넣고 버튼의 state에 따라 이미지를 변경하기로 했다.
그래서 처음에 이렇게 구현했다.

[button setImage:offImage forState:UIControlStateNormal];

[button setImage:onImage forState:UIControlStateSelected];

[button setImage:tapImage forState:UIControlStateHighlighted]; 

헉쓰!!  
버튼이 select 된 후 다시 press 하면 highlight 이미지가 나타나지 않고 이미지에 색이 사라져 나타난다. 
 아놔.. 색깔 나와야 되는뎅.. 나와야 한다고... 제발 ㅠ

그래서!!
구글링 한 결과 나랑 같은 문제 겪고 있는 분의 해결책을 살포시 아주 살포시 가져왔다.

단 한줄을 더 추가하면 된다.
[button setImage:tapImage forState:UIControlStateSelected | UIControlStateHighlighted];

어떤 이들은 선택할 때마다 이미지를 normal로 변경하라며 날 당황시켰는데
결국 문제를 제시한 이가 해결책도 제시했다. 
 

꺅 무튼 해결했당 - 

맵뷰의 annotationview를 뿌리는거까진 참~~ 좋았는데...

선택이 한번밖에 안된다.

한번 선택한 뷰를 연속 선택했을 때 select 어쩌구 하는 delegate 메소드를 호출하지 않는단 소리!!

어익후~ 이런 문제가 발생할 줄은 꿈에도 몰랐다 ㅠ.ㅠ

그래서 구글링 디적디적... 흘깃흘깃

헉...

annotation은 selection 접근이 가능하지만 뷰는 참조만 될뿐 set이 안된단다...

뭐 이런기 다있노 =ㅁ=

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

방법 발견했따!!

역시 JJ님은 대단하셔 ㅋ

맵뷰에 보면 select 된 annotation을 deselect 할 수 있다.

[mapView deselectAnnotation:_selectedMapAnnotationView.annotation animated:NO];


허거덩 -

요로코롬 하면 되는구나 괜히 오늘 삽질했넹 ㅠ

아침에 가자마자 해야겠다

크앍!

1. 인증서
- 앱 ID 등록 ( Push Notification Developer/Production version )
configure 눌러서 인증서와 키를 만들어 저장 후
키체인 접근 > 인증 지원 > 인증 기관에서 인증서 요청
-  
certificates 에 등록하면 사이트에 인증서와 키가 생성
- provisioning 수정 후 다운로드
- 인증서와 키 연결짓기 ( organizer 에서 키 인증서에 등록)
- 테스트를 위한 pem 파일 만들기 (터미널에서)
openssl pkcs12 -in 
CertificateName.p12 -out CertificateName.pem -nodes

 - 참고 URL : 마이리키닷넷 http://myriky.net/119
                      Shahzad Bhatti  http://weblog.plexobject.com/?p=1680

2.  서버 구현
애플 서버로 클라이언트에서 받은 디바이스토큰과 certificate.pem 파일, 배지, 노티사운드,  키워드, 키워드에 대한 값(노티로 날아갈 내용)을 보내면 애플서버에서 디바이스 토큰을 이용해 노티를 날림

3. 클라이언트 구현

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken

{

//디바이스 토큰 받는 곳 

NSLog(@"deviceToken %@",deviceToken);

}


- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error

{

NSLog(@"error %@", error);

}


- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo

{

//애플서버로부터 받은 information으로 alert 날림 

NSDictionary *aps = [userInfo valueForKey:@"aps"];


application.applicationIconBadgeNumber = [[aps valueForKey:@"badge"] integerValue] + 1;

UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"asdfasdf"message:@"asdfasdfsadfasd" delegate:self cancelButtonTitle:@"OK"otherButtonTitles:nil];

[alertView show];

[alertView release];

}


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

{

[application registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];

id tmpPushNotiDic = [launchOptions objectForKey:@"UIApplicationLaunchOptionsRemoteNotificationKey"];

if( tmpPushNotiDic != nil )

{

self.pushNotiDic = [tmpPushNotiDic valueForKey:@"aps"];

}

    [window addSubview:viewController.view];

    [window makeKeyAndVisible];

return YES;

}


- (void)applicationWillTerminate:(UIApplication *)application

{

application.applicationIconBadgeNumber = 0;

} 

+ Recent posts