iOS4 로 업글되면서 XCode도 같이 업데이트했더니..어라?
3.1이 안보인다.
그럼 나같이 아직도 3.1 쓰는 사람은 어떻게 개발하라고?

개발 시 필요한 Framework가 달라졌다. 그래서 컴파일도 안되고..ㅋㅋ
사용자 삽입 이미지

위와 같이 AVFoundation.framework는 3.x에는 없다. 이럴 경우 Role을 Required에서 Weak로 변경해 준다.

그리고 프로젝트 정보에서 배포를 3.x로 변경한다.
사용자 삽입 이미지

이렇게 하면 3.x로 컴파일도 되고, 배포도 가능하다.
단 소스에서 버전별로 처리를 해야 하는 부분이 있다면,

[[[UIDevice currentDevice] systemVersion] doubleValue] < 3.2

위와 같이 시스템의 버전을 확인한 후에 코딩이 필요하다.
근데 진짜 삽질 많이 해야 한다. iOS4가 되면서 API가 많이 달라져서..

WIPI도 그랬는데, Android 도 그렇고..젠장 이제는 iPhone까지
하위버전에 대한 100% 호환을 안해주면 어쩌란 말이냐?



Posted by 피의복수

iOS4가 나오면서 조금씩 달라지는 API들.
역시 Upgrade에 장사없다고, 하위버전에 대한 호환이 안되는군. OS자체를 다 바꿔야 하니..ㅋㅋ

일단 아래와 같이 3.2를 기준으로 하위 버전과 상위버전에 대한 처리를 다르게 해 본다.

/**
 * Video Play
 * @param data : 인식된 data
 */
- (void) playMovie: (NSString *) dataValue
{
    NSString *movieURL;
   
    movieURL = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"mp4"];

    /// iPhone Device 버전에 따라 동영상 Play
    if ([[[UIDevice currentDevice] systemVersion] doubleValue] >= 3.2) {
        /// MPMoviePlayerViewController 초기화
        MPMoviePlayerViewController *playerView = [[[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL fileURLWithPath:movieURL]] autorelease];
        playerView.view.backgroundColor = [UIColor blackColor];
        playerView.moviePlayer.scalingMode = MPMovieScalingModeAspectFit;
       
        /// 동영상 끝났을때 호출
        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(playbackDidFinish:)
                                                     name:MPMoviePlayerPlaybackDidFinishNotification
                                                   object:playerView.moviePlayer];
        /// Play the movie
        [self presentMoviePlayerViewControllerAnimated:playerView];
    }
    else if    ([[[UIDevice currentDevice] systemVersion] doubleValue] < 3.2) {
        /// MPMoviePlayerController 초기화
        MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:movieURL]];
        moviePlayer.initialPlaybackTime = 0;
        moviePlayer.scalingMode = MPMovieScalingModeAspectFill;
        moviePlayer.movieControlMode = MPMovieControlModeDefault;
        /// 동영상 끝났을때 호출
        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(playbackFinishedCB:)
                                                     name:MPMoviePlayerPlaybackDidFinishNotification
                                                   object:moviePlayer];
        /// Play the movie
        [moviePlayer play];
    }
}



/**
 * when the movie is finished
 */
- (void) playbackFinishedCB:(NSNotification *) aNotification
{
    if ([[[UIDevice currentDevice] systemVersion] doubleValue] >= 3.2) {
        MPMoviePlayerController *player = [aNotification object];
        [[NSNotificationCenter defaultCenter] removeObserver:self
                                                        name:MPMoviePlayerPlaybackDidFinishNotification
                                                      object:player];
        [player stop];
        [self dismissMoviePlayerViewControllerAnimated];
    }
    else if ([[[UIDevice currentDevice] systemVersion] doubleValue] < 3.2) {
         MPMoviePlayerController *player = [aNotification object];
       
        [[NSNotificationCenter defaultCenter] removeObserver:self
                                              name:MPMoviePlayerPlaybackDidFinishNotification
                                              object:player];
        [player stop];
        [player release];
    }
}


Posted by 피의복수

BLOG main image
일에 필요한 자료 by 피의복수

카테고리

분류 전체보기 (40)
프로그램이야기 (38)
outlook (1)
Twitter (0)
Mobile (0)
메일 (0)
시스템관리 (0)
프로그램환경설정 (0)
안드로이드 (32)
Augmented Reality (1)
iPhone (2)
모바일 SNS (0)
위치관련 (0)
MAC 사용하기 (1)
Postgres Plus® Advanced Ser.. (0)
Hadoop (0)
Hive (0)
Shell Script (0)
AngulaJs (0)
Spring Boot (0)
Database (0)
끄적끄적 (1)
취미 (0)
서비스이야기 (1)
빅데이터 (0)

최근에 올라온 글