MKMapView에 위도/경도 범위를 넘어서는 Annotation을 추가하면 어떻게 될까?

정답은 악명 높기로 소문난 EXC_BAD_ACCESS.

개발중인 앱에서 한번에 적게는 100여개에서 많게는 500여개 정도 한번에 Annotation을 추가한다.
문제 없이 잘 돌아가던 녀석인데, 리뷰를 앞두고 별안간 죽어나가기 시작했다.
도무지 죽는 원인을 찾을 수 없었고, 혹시나 하는 마음에 300여개의 데이타를 일일이 콘솔에 찍어서 값을 확인했다.
위에서부터 차근차근 확인해 봤지만 문제가 없어서 포기하려던 순간! 마지막 데이타의 위도/경도가 110/110인 것을 확인!! ㅠㅠ

이런 망할.. 이놈이었어!
MapKit을 너무 신뢰했다. 잘못된 값이 들어가도 이정도의 예외처리를 될 줄 알았는데..
담부터 입력값을 꼼꼼히 체크해서 바인딩해야 겠다.

참고로 위도 경도의 범위는 위도 -90~90, 경도 -180~180이다.
Creative Commons License
Creative Commons License
Posted by 지오아빠^^
앱에서 푸시 알림 설정(사운드, 경고, 알림표시)을 변경하는 것인 가능한지 찾고 있다.
결과적으론 못찾았다 -ㅅ-;
아마도 해킹을하지 않으면 불가능 하지 않을까 싶다.

[[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];
[[UIApplication sharedApplication] unregisterForRemoteNotifications];

위에 두 녀석으로는 세부 설정까지는 수정 할 수 없고 알림 설정에서 추가/삭제 하는 것 까지는 가능하더라.
삭제 후 다시 추가하여도 이전에 설정 되어있는 세부 설정이 그대로 적용된다.
Creative Commons License
Creative Commons License
Posted by 지오아빠^^
아래 링크에서 Resetting the Push Notifications Permissions Alert 부분에 나와있군요.

http://developer.apple.com/library/ios/#technotes/tn2010/tn2265.html
Creative Commons License
Creative Commons License
Posted by 지오아빠^^

iPad & Bluetooth Keyboard

APPLE 2010/07/07 19:54


iPad에 Bluetooth 키보드를 연결해봤습니다.
아이패드 세팅에서 블루투스 ON해주면 사용가능한 장치를 자동으로 검색합니다.
검색 결과에 불루투스 키보드를 선택하면 키보드로 키값을 입력하고 엔터키를 입력하라고 합니다.
시키는 대로 해주면 설정 끝!
iOS4가 설치된 아이폰도 지원한다고 합니다.

인증!!

사용자 삽입 이미지
Creative Commons License
Creative Commons License
Posted by 지오아빠^^

iOS 3.1.3 까지는 동영상 재생을 원할때 MPMoviePlayerController를 사용했었습니다.
iOS 3.2 이상 버전에서는 MPMoviePlayerViewController가 추가되었습니다.

아래와 같이 사용하면 3.1.3 이전 버전과 3.2 이상 버전에서 모두 동작하도록 할 수 있습니다.
제 경우에는 UIViewController에 아래 코드를 추가하고 동영상 재생을 원하는 곳에서 노티피케이션으로 알려서 재생을 하는 방식으로 처리했습니다.


- (void) moviePlayBack:(NSNotification *)noti {

NSURL *movieURL = (NSURL *)[[noti userInfo] objectForKey:@"url"];

if ([[[UIDevice currentDevice] systemVersion] doubleValue] >= 3.2) {

MPMoviePlayerViewController *playerView = [[MPMoviePlayerViewController alloc] initWithContentURL:movieURL];

playerView.view.backgroundColor = [UIColor blackColor];

playerView.moviePlayer.scalingMode = MPMovieScalingModeAspectFit;

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playbackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:playerView.moviePlayer];

[self presentMoviePlayerViewControllerAnimated:playerView];

[playerView release];

} else if ([[[UIDevice currentDevice] systemVersion] doubleValue] < 3.2) {

MPMoviePlayerController* moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];

moviePlayer.scalingMode = MPMovieScalingModeAspectFit;

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playbackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer];

[moviePlayer play];

}

}


- (void) playbackDidFinish:(NSNotification *)noti {

if ([[[UIDevice currentDevice] systemVersion] doubleValue] >= 3.2) {

    MPMoviePlayerController *player = [noti object];

    [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:player];

    [player stop];

    [self dismissMoviePlayerViewControllerAnimated];

} else if ([[[UIDevice currentDevice] systemVersion] doubleValue] < 3.2) {

    MPMoviePlayerController *player = [noti object];

    [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:player];

    [player stop];

    [player release];

        }

}

Creative Commons License
Creative Commons License
Posted by 지오아빠^^