• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [iPhone] Application running for the very first time...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [iPhone] Application running for the very first time...


  • Subject: Re: [iPhone] Application running for the very first time...
  • From: Alex Kac <email@hidden>
  • Date: Thu, 1 Oct 2009 14:20:19 -0500

As I said - I wrote it into the email by memory typed code so... :) But the idea was still there.

On Oct 1, 2009, at 2:17 PM, Sidney San Martín wrote:

I think some of those values may be flipped:

NSMutableDictionary *dictionary = [[NSMutableDictionary alloc]
initWithCapacity:10];
[dictionary setObject: [NSNumber numberWithBool:YES] forKey:PIFirstRun];
[[NSUserDefaults standardUserDefaults] registerDefaults:dictionary];
[dictionary release];



if ([[NSUserDefaults standardUserDefaults] boolForKey:PIFirstRun] == YES){
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:PIFirstRun];
//first run
}


On Thu, Oct 1, 2009 at 12:45 PM, Alex Kac <email@hidden> wrote:
You set the default of a NSUserDefault. Set that default to FALSE. Then on
startup, check the value. If its FALSE - set it to TRUE and you know its the
first time. Here is some from-memory typed code:


NSMutableDictionary *dictionary = [[NSMutableDictionary alloc]
initWithCapacity: 10];
[dictionary setObject: [NSNumber numberWithBool:NO] forKey:
PIFirstRun];
[[NSUserDefaults standardUserDefaults] registerDefaults: dictionary];
[dictionary release];



if ([[NSUserDefaults standardUserDefaults] boolForKey:PIFirstRun] ==
YES)
{
[[NSUserDefaults standardUserDefaults] setBool:YES
forKey:PIFirstRun];
//first run
}


On Oct 1, 2009, at 11:24 AM, James Lin wrote:

Can you please elaborate on this a bit more?

I am already using NSUserDefaults for my preferences values.
But I fail to see how this apply to determining if an Application is
launched for the very first time...

What do I do?
Check to see if an NSUserDefault item exists?

Thanks for the help...

James
On 2009/10/1, at 下午5:53, Mark Woollard wrote:

No they aren't - NSUserDefaults is the approach I use for this kind of
thing


Sent from my iPhone

On 1 Oct 2009, at 09:32, Todd Heberlein <email@hidden> wrote:

I am wondering if there is a simple way to find out when my application
is running for the VERY FIRST TIME on an iPhone?
So that I can set an integer variable once only at this moment...


What's the best way to do this?

Also, NSUserDefaults supports this basic capability. I'm just wondering
if all these defaults for your app are visible from the settings application
on the iPhone (it is too late and my brain is fried); that would screw up
this approach.


Todd

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com


Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

Alex Kac - President and Founder Web Information Solutions, Inc.

"There will always be death and taxes; however, death doesn't get worse
every year."
-- Anonymous





_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


Alex Kac - President and Founder Web Information Solutions, Inc.

"The optimist proclaims that we live in the best of all possible worlds; and the pessimist fears this is true."
-- James Clabell





_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: [iPhone] Application running for the very first time... (From: Todd Heberlein <email@hidden>)
 >Re: [iPhone] Application running for the very first time... (From: Mark Woollard <email@hidden>)
 >Re: [iPhone] Application running for the very first time... (From: James Lin <email@hidden>)
 >Re: [iPhone] Application running for the very first time... (From: Alex Kac <email@hidden>)
 >Re: [iPhone] Application running for the very first time... (From: Sidney San Martín <email@hidden>)

  • Prev by Date: Re: [iPhone] Application running for the very first time...
  • Next by Date: Re: NSValueTransformer problem with NSTextField update
  • Previous by thread: Re: [iPhone] Application running for the very first time...
  • Next by thread: Re: [iPhone] Application running for the very first time...
  • Index(es):
    • Date
    • Thread