Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 30th, 2012  |  syntax: None  |  size: 0.38 KB  |  hits: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. iPhone SDK equivalent to C#'s BitConverter.GetBytes() and BitConverter.ToInt32()
  2. NSNumber *aNumber = ...wherever this comes from...;
  3. NSData *dataBlob = [NSKeyedArchiver archivedDataWithRootObject:aNumber];
  4.  
  5. /* and, later; this will return an autoreleased object so you quite possibly want
  6.    to retain it */
  7. NSNumber *number = [NSKeyedUnarchiver unarchiveObjectWithData:dataBlob];