Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6840057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:47:39+00:00 2026-05-26T23:47:39+00:00

In my app, users purchase consumables, let’s say suitcases, that are stored in Core

  • 0

In my app, users purchase consumables, let’s say suitcases, that are stored in Core Data. When the user first installs the app, I give them a freebie to get started. The app can’t function without at least one suitcase set up.

But if the user installs the app on their iPhone and then their iPad and syncs the two, they now have 2 suitcases. And if they uninstall the app on either device, then reinstall and sync it, they’ve just gained an extra one and they can do that indefinitely.

I can see two solutions, but none of them seem right:

  1. Add a value to NSUbiquityKeyValueStore when the user first syncs with iCloud. Check this value on first launch. If it’s nil, create the freebie, if it’s not, sync data. But this creates a problem. What if the user disables iCloud or has no internet connection on first launch. The app would create the freebie, then when iCloud is available, sync the duplicate, and they could do this as many times as they like.

  2. Somehow match the default items on each app. I had the idea of matching objectIDs or timestamps, but these would vary and I’m not sure how to handle it.

Does anyone know anything I could do about this?

EDIT:

Using a prepackaged database plus migratePersistentStore:toURL:options:withType:error: seems to be the way to go. Will post an answer with code if it works for me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:47:40+00:00Added an answer on May 26, 2026 at 11:47 pm

    The best solution to this, in my opinion, is to store UDIDs in an array in iCloud UbiquitousKeyValueStore.

    //Store UDID in iCloud
    if ([[[UIDevice currentDevice] systemVersion] doubleValue] >= 5.0) {
        if ([[NSFileManager defaultManager] URLForUbiquityContainerIdentifier:nil]) {
            NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore];
    
            //Get array
            NSMutableArray *devices = [NSMutableArray arrayWithArray:[store arrayForKey:@"UDID"]];
            [devices addObject:[[UIDevice currentDevice] uniqueIdentifier]];
    
            //Create new array, set to kvstore
            NSArray *newDevices = [NSArray arrayWithArray:devices];
            [store setArray:newDevices forKey:@"UDID"];
            [store synchronize];
        }
    }
    

    …

       //Check if app already installed on device
       NSArray *devices = [[NSUbiquitousKeyValueStore defaultStore] arrayForKey:@"UDID"];
    
        for (NSString *UDID in devices) {
            if ([UDID isEqualToString:[[UIDevice currentDevice] uniqueIdentifier]]) {
                  //stop the giveaway
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application with In-App Purchase, that when the user buy something, download
I am wanting to have an In-App Purchase that allows my users to import
I have an app that allows users to purchase publications that download to their
I have an app that uses core data. The app is free for download
I am implementing in app purchase (non consumable type - songs ).when a user
I am developing a BlackBerry app in which users can purchase virtual goods (such
I have a product I'm selling. Users purchase a license key and enter that
I have an app that I want users to be able to pay a
I'm building an app that uses In app purchase. I'm using non-consumable product types.
I'm a new developer working on an app that allows users to record vocals

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.