title: how to run a code exactly once for all of its life for each user in objective-c
body: <p>is there a way to run a code only once?Not for each usage.When the user download the app and runs it, the code will run only once and not anymore.</p>
  
  <p>i tried to create a integer with initial 0 and save it to nsuerdefaults.</p>
  
  <p>and made this special code in a if statement check, if its 0 enter the code but if its not 0 don't enter it, and in the if statement i incremented 0 and saved it so it won't ever again enter it.</p>
  
  <p>but it didn't work out</p>
  
  <pre><code> NSInteger temp = [[NSUserDefaults standardUserDefaults] integerForKey:@"forOnce"];
  
  
  if (temp==0) {
  
  int k=0;
  
  if (NSClassFromString(@"CTTelephonyNetworkInfo"))
  {
  
  CTTelephonyNetworkInfo *netInfo =[[CTTelephonyNetworkInfo alloc]init];
  CTCarrier *carrier =[netInfo subscriberCellularProvider];
  
  
  testUser[@"Carrier"]=[carrier carrierName];
  //NSLog(@"carrier bu %@",[carrier carrierName]);
  
  
  
  
   }
  
      temp++;
  
  
      [[NSUserDefaults standardUserDefaults] setInteger:k forKey:@"forOnce"];
      [[NSUserDefaults standardUserDefaults] synchronize];
  
      }
  </code></pre>
  
  <p>the code was something like that</p>