본문 바로가기

iOS

앱스토어 버전 가져오기

앱스토어 버전가져오기


 NSDictionary *bundleInfo = [[NSBundle mainBundle] infoDictionary];

    NSString *bundleIdentifier = [bundleInfo valueForKey:@"CFBundleIdentifier"];

    NSURL *lookupURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://itunes.apple.com/lookup?bundleId=%@", bundleIdentifier]];

    NSData *lookupResults = [NSData dataWithContentsOfURL:lookupURL];

    NSDictionary *jsonResults = [NSJSONSerialization JSONObjectWithData:lookupResults options:0 error:nil];

    

    NSUInteger resultCount = [[jsonResults objectForKey:@"resultCount"] integerValue];

    if (resultCount){

        NSDictionary *appDetails = [[jsonResults objectForKey:@"results"] firstObject];

        NSString *latestVersion = [appDetails objectForKey:@"version"];

        NSString *currentVersion = [bundleInfo objectForKey:@"CFBundleShortVersionString"];

    }


더궁금하시면 댓글 남겨주세요 

'iOS' 카테고리의 다른 글

[swift] Util(String)  (0) 2017.12.01
[swift] iOS 주소 찾기  (0) 2017.11.15
iOS AudioSession 공부중....  (0) 2015.05.28
NSDate 대해서  (0) 2015.05.06
apple mapKit 사용방(구글이 안해주는 길찾기기능 포함)  (0) 2015.04.30