美文网首页iOS干货
iCloud云存储开发实例(亲测可用)

iCloud云存储开发实例(亲测可用)

作者: 不要虚度美好的时光 | 来源:发表于2022-05-08 06:50 被阅读0次

    1. iCould Key-Value storage

    #pragma mark - key-value storage
    + (void)setUpKeyValueICloudStoreWithKey:(NSString *)key value:(NSString *)value;
    {
        NSUbiquitousKeyValueStore *keyValueStore = [NSUbiquitousKeyValueStore defaultStore];
        [keyValueStore setObject:value forKey:key];
        [keyValueStore synchronize];
        NSLog(@"向iCloud保存是否已经购买值:key:%@, Value: %@", key, value);
    }
    
    + (NSString *)getKeyValueICloudStoreWithKey:(NSString *)key
    {
        NSUbiquitousKeyValueStore *keyValueStore = [NSUbiquitousKeyValueStore defaultStore];
        NSString *testString = [keyValueStore objectForKey:key];
        NSLog(@"向iCloud查询是否已经购买值:key:%@, Value: %@", key, testString);
    
        return testString;
    }
    

    2. iCould Documents:

    iOS: iCloud开发案例

    3.iCloud CloudKit(待补充)

    相关文章

      网友评论

        本文标题:iCloud云存储开发实例(亲测可用)

        本文链接:https://www.haomeiwen.com/subject/jfrgertx.html