• 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: TUTORIAL: Generating Unique ID Strings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: TUTORIAL: Generating Unique ID Strings


  • Subject: Re: TUTORIAL: Generating Unique ID Strings
  • From: Jens Alfke <email@hidden>
  • Date: Fri, 14 May 2010 10:00:24 -0700

A couple of points on the code:

(1) If you're concerned about size, store the IDs in NSData instead of NSString. That way you get the full 8 bits per byte instead of 6, and avoid the complication of translating to and from ASCII.

(2) If you do need to convert to string, it would be safer to use an existing Base64 converter rather than writing your own as you've done. This kind of bit-twiddling code is very prone to error. Probably the quickest way is to use the Base64 support in the OpenSSL library; a bit of searching in the list archives should turn up some sample code.

(3) I'm sort of confused by Thomas Wetmore's comment that "my application generates billions of [unique ids]". That's way too many to be sending over the network, so these must be used locally. But in that case, generating unique IDs becomes much easier, and the IDs a lot smaller: just increment a 32-bit counter.

—Jens_______________________________________________

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


  • Follow-Ups:
    • Re: TUTORIAL: Generating Unique ID Strings
      • From: Thomas Wetmore <email@hidden>
References: 
 >TUTORIAL: Generating Unique ID Strings (From: Bill Hernandez <email@hidden>)

  • Prev by Date: Re: how to terminate first AlertPanel when second AlertPanel appears?
  • Next by Date: Re: TUTORIAL: Generating Unique ID Strings
  • Previous by thread: TUTORIAL: Generating Unique ID Strings
  • Next by thread: Re: TUTORIAL: Generating Unique ID Strings
  • Index(es):
    • Date
    • Thread