• 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
Category class method problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Category class method problem


  • Subject: Category class method problem
  • From: Kaspar Fischer <email@hidden>
  • Date: Thu, 9 Mar 2006 20:26:55 +0100

Hi,

What is the problem with the following code? It must be
something simple, because it results in a bus error at (*)
-- but I ust don't see it!

@implementation NSString (KFStringUtilities)

+ (NSString *)nameOfTemporaryFileWithExtension:(NSString *)extension
{
  static int sequenceNumber = 0;
  NSString *tmpDir = NSTemporaryDirectory();
  if (tmpDir == nil)
    tmpDir = @"/tmp/";
  NSString *name;
  do {
    sequenceNumber++;
    name = [NSString stringWithFormat:@"%@/%d-%d.%@", // (*)
            [[NSProcessInfo processInfo] processIdentifier],
            (int)[NSDate timeIntervalSinceReferenceDate],
            sequenceNumber,
            extension];
  } while ([[NSFileManager defaultManager] fileExistsAtPath:name]);
  return name;
}

@end

Thanks,
Kaspar
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Category class method problem
      • From: Andy Lee <email@hidden>
  • Prev by Date: Re: Design Decision: Passing Information Between Two Applications
  • Next by Date: Re: Undo and NSArrayController and CoreData
  • Previous by thread: Re: Design Decision: Passing Information Between Two Applications
  • Next by thread: Re: Category class method problem
  • Index(es):
    • Date
    • Thread