Keychain group access to share data between my existing applications

前端 未结 3 1819
别跟我提以往
别跟我提以往 2020-11-28 23:25

I have many iOS applications live on AppStore. Now for next version of apps, I want to keep a piece of data for every application to share in KeyChain. As far as I know I ne

3条回答
  •  孤街浪徒
    2020-11-29 00:07

    Now you can use UIPasteboard

    //First app, install->run->close->delete
    UIPasteboard* board = [UIPasteboard pasteboardWithName:@"com.company.wtv" create:YES];
    board.persistent=YES;// persistent to make what you write persist after your app closes, or gets deleted.
    [board setValue:@"ccccc" forPasteboardType:@"com.company.wtv.sharedValue"];
    
    //Second app, installed after first one is deleted and ran this one... While bundle identifier and bundle seed different (i tried it on adhoc, not really releasing the app, but i htink the same)
    NSData* result=nil;
    NSString*resultStr=nil;
    result =[board valueForPasteboardType:@"com.company.wtv.sharedValue"];
    resultStr=[[NSString alloc] initWithData:result encoding:NSUTF8StringEncoding];// I got resultStr containing ccccc
    

    check UIPasteboard documentation for further info. I'll be coming back after using this for my store apps, in case of troubles

提交回复
热议问题