외규장각 도서 환수 모금 캠페인

 //iCloud 막을 Document경로 설정

    NSString *documentPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMaskYESlastObject];

    NSURL *pathURL= [NSURL fileURLWithPath:documentPath];

    

    NSLog(@"%@",documentPath);

    

    if([[[UIDevice currentDevicesystemVersionfloatValue] > 5.0f){

        [self addSkipBackupAttributeToItemAtURL:pathURL];

    }else{

        NSLog(@"CANNOT - CUZ VERSION IS UNDER 5.0.1");

    }



//밑으로 애플에서 알려준 코드 URL에 경로
그래서 위에서 5.0.1버전 부터 호출 하도록하고
경로를 설정.

//Cloud Data 백업 방지...

- (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL

{

    const char* filePath = [[URL pathfileSystemRepresentation];

    

    const char* attrName = "com.apple.MobileBackup";

    u_int8_t attrValue = 1;

    

    int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 00);

    return result == 0;

}


Posted by 닉네임영역
,

* 이렇게 싱글톤으로 안하고 직접 Prefix.pch에 바로 전역 선언으로 만들어 쓰는 방법도 있습니다. 


이제 선언했으니 함수에서 사용합니다.

@implementation Object

static Object *__sharedObject;

+ (Object *)sharedObject {

        if (__sharedObject == nil) {

                __sharedObject = [[Object alloc] init];

        }

        return __sharedObject;

}

@end

Posted by 닉네임영역
,
1. StoreKit.framework 라이브러리를 추가해줍니다 
2. 헤더파일에 #import <StoreKit/SKStoreProductViewController.h>를 추가합니다
3. SKStoreProductViewControllerDelegate 델리게이트를 추가해줍니다

[self presentAppStoreForID:[NSNumber numberWithInt:앱아이디inView:띄울 부모뷰(self.view) withDelegate:self withURL:[NSURLURLWithString:iOS6 이전 버전에 사용할 앱스토어 링크]];



- (void)presentAppStoreForID:(NSNumber *)appStoreID inView:(UIView *)view withDelegate:(id<SKStoreProductViewControllerDelegate>)delegate withURL:(NSURL *)appStoreURL

{

    if(NSClassFromString(@"SKStoreProductViewController")) { // iOS6 이상인지 체크


        SKStoreProductViewController *storeController = [[SKStoreProductViewController allocinit];

        storeController.delegate = delegate; // productViewControllerDidFinish


        NSDictionary *productParameters = @{ SKStoreProductParameterITunesItemIdentifier : appStoreID };



        [storeController loadProductWithParameters:productParameters completionBlock:^(BOOL result, NSError *error) {

            if (result) {

                [self presentViewController:storeController animated:YES completion:nil];

            } else {

                [[[UIAlertView allocinitWithTitle:@"연결 실패" message:@"앱을 불러올  없습니다." delegate:nil cancelButtonTitle:@"확인"otherButtonTitlesnil] show];

            }

        }];

    } else { // iOS6 이하일 

        [[UIApplication sharedApplicationopenURL:appStoreURL];

    }

}


// 닫을 때 

- (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController {

    [viewController dismissModalViewControllerAnimated:YES];

}


Posted by 닉네임영역
,


사랑합니다. 편안히 잠드소서