chflags in iPhone?

Discussion in 'iOS Development' started by raziiq, Jul 11, 2010.

  1. raziiq

    raziiq New Member

    Joined:
    Aug 23, 2009
    Messages:
    54
    Likes Received:
    0
    Hi there.

    Is there anything like chflags in iPhone? Because whenever i type command in MobileTerminal with chflags, i get command not found error.

    How to check if file is "system immutable" ?
  2. lauNchD

    lauNchD Well-Known Member

    Joined:
    Jan 27, 2008
    Messages:
    1,844
    Likes Received:
    261
    Device:
    iPhone 5 (Black)
    1. Files aren't called "immutable," they're called read-only

    Please Register or Log in to view images


    2. chflags is installed on my iPod. Maybe your PATH environment variable is set incorrectly.
    3. Are you trying to use this in an app by calling system()? That's bad.
  3. raziiq

    raziiq New Member

    Joined:
    Aug 23, 2009
    Messages:
    54
    Likes Received:
    0
    No no i m not gonna do system().

    Actually my app has to write to /System/Library/CoreService/SystemVersion.plist and my app has root access but still i cant edit plist, so i was wondering if its flag is read-only.

    Any advices on this??
  4. lauNchD

    lauNchD Well-Known Member

    Joined:
    Jan 27, 2008
    Messages:
    1,844
    Likes Received:
    261
    Device:
    iPhone 5 (Black)
    You can use NSFileManager (check out the Apple docs) for all kinds of filesystem "handling"/info.
  5. raziiq

    raziiq New Member

    Joined:
    Aug 23, 2009
    Messages:
    54
    Likes Received:
    0
    I am using NSDictionary to get all the info from SystemVersion.plist and then i am changing some value and then writing that info back to that NSDictionary using SystemVersion.plist.

    Here is code i m using to write the file

    Code:
    NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath];
    [dict setValue:SomeValue forKey:@"SomeValue"];
    [dict writeToFile:plistPath atomically:YES];
    

Share This Page