createDirectoryAtPath: is depreceated

Discussion in 'Mac Programming' started by Blakeasd, Feb 8, 2011.

  1. Blakeasd macrumors 6502a

    Joined:
    Dec 29, 2009
    #1
    Hello.
    I recently upgraded to a newer version of Xcode (Under NDA).
    It works fine in my older Xcode version ,but no I get depreciation errors, so I have to replace it with something. (Xcode 3.2 only warned me). Does anyone know an equivalent to createDirectoryAtPath: that has not been deprecated.
    Thanks
     
  2. ccamelot macrumors member

    ccamelot

    Joined:
    Feb 21, 2010
    Location:
    Poland
    #2
    Here you go

    From NSFileManager.h:

    /* createDirectoryAtPath:withIntermediateDirectories:attributes:error: creates a directory at the specified path. If you pass 'NO' for createIntermediates, the directory must not exist at the time this call is made. Passing 'YES' for 'createIntermediates' will create any necessary intermediate directories. This method returns YES if all directories specified in 'path' were created and attributes were set. Directories are created with attributes specified by the dictionary passed to 'attributes'. If no dictionary is supplied, directories are created according to the umask of the process. This method returns NO if a failure occurs at any stage of the operation. If an error parameter was provided, a presentable NSError will be returned by reference.

    This method replaces createDirectoryAtPath:attributes:
    */
    Code:
    - (BOOL)createDirectoryAtPath:(NSString *)path withIntermediateDirectories:(BOOL)createIntermediates attributes:(NSDictionary *)attributes error:(NSError **)error;
    all best
    Les
     
  3. Blakeasd thread starter macrumors 6502a

    Joined:
    Dec 29, 2009
    #3
    Works Now

    Thanks it works now. Where can I find the replacements for depreciated methods as I still have one more that is depreciated.
     
  4. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #4
    http://developer.apple.com/library/...apple_ref/occ/clm/NSString/stringWithCString:

    That's a link to a deprecated method in the docs. It's unlikely that a method will be removed without a replacement, though it's possible. In this case, though, there is details about the replacement you should use. I'd say look at the docs when you run into a deprecated method. In your case:
    http://developer.apple.com/library/...FileManager/createDirectoryAtPath:attributes:

    The method mentioned above is right there.

    Also, don't break NDAs. You didn't have to say anything about it here, that method was deprecated in 10.5.

    -Lee
     
  5. foidulus macrumors 6502a

    Joined:
    Jan 15, 2007
    #5
    What Lee said, I would also add that changes in deprecation/removal of methods(which is quite rare, however Apple has removed entire libraries before) only happen when new versions of the operating system are released, XCode has no effect on them. XCode is an IDE, the actual libraries and whatnot are all provided by the OS.
     

Share This Page