Path to Info.plist?

Discussion in 'iOS Development' started by Jehsup, Jan 13, 2009.

  1. Jehsup

    Jehsup

    New Member

    Joined:
    May 22, 2008
    Messages:
    166
    Hello,

    How can I get my runtime path to Info.plist? I am trying to implement a poor man's copy protection by checking for an inserted key\value. That seems to be the most common hack method out there. The file exists in the .app bundle right at the application level, one level up from the Data folder that I strip off of the Application.dataPath, but still nothing. I have also tried the naked filename which is most intuitive, but that fails too.

    --J
     
  2. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Messages:
    6,186
    This was asked earlier (here) with no answer given, I've put up the bat signal asking for help from dev to get an answer to this question, stay tuned!
     
  3. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Messages:
    6,186
    Renaldas has now provided some information in this thread.
     
  4. Jehsup

    Jehsup

    New Member

    Joined:
    May 22, 2008
    Messages:
    166
    Thanks, Tom, but I am not looking for player prefs. I am specifically looking for the file "Info.plist" that is part of a release and distribution build produced by XCode compile. I can access my save game file externally and "Info.plist" is just a file so I am sure I can access that too. There is just something very odd about the filepath to it.

    "Info.plist" is part of the .app package bundle. It is this files contents that will have changed in a hacked version of my application. At least by hacking the most common way that we iPhone developers are getting hit with. The (hacked version) of this file contains an inserted key\value pair that I want to check for the existence of.

    Any other pointers? Maybe have that dev look at my post specifically.

    --J
     
  5. HiggyB

    HiggyB

    Unity Product Evangelist

    Joined:
    Dec 8, 2006
    Messages:
    6,186
    Ah yes, sorry about that. I do see the built app's info.plist file there inside the app bundle at the top-level too. How specifically are you trying to access it? I'd think that checking the application path is the way to go but that seems wrong (based on your posts) so I'm a bit stumped.
     
  6. ReJ

    ReJ

    Unity Technologies

    Joined:
    Nov 1, 2008
    Messages:
    359
    Well, first Unity does not do anything special with Info.plist that's for sure. Second, I'm not sure if you can access application's Info.plist file (from iPhone security stand point). Take a look at "File and Data Management" section in iPhone OS Programming Guide or try using CFBundle.

    All those functions are accessible only in ObjectiveC, so you'll have to modify AppController.mm. If you find anything useful for protection, then we would provide access to related functions via scripts in upcoming releases.
     
  7. Jehsup

    Jehsup

    New Member

    Joined:
    May 22, 2008
    Messages:
    166
    Thanks you, and yes, that is where we ended up finding it. Specifically here for anyone else that is interested.

    https://developer.apple.com/iphone/...e/FilesandNetworking/chapter_8_section_2.html

    So the path would look something like....

    /var/mobile/Applications/30B51836-D2DD-43AA-BCB4-9D4DADFED6A2/YourAppName.app/Info.plist

    So if you strip off the 'Data' portion of the Application.dataPath and append "YourAppName.app/Info.plist" and use that as your filepath, you are in business.

    Thanks for replies. I appreciate your time.
     
  8. Jehsup

    Jehsup

    New Member

    Joined:
    May 22, 2008
    Messages:
    166
    By the way. This is the approach we are taking. Except not modifying any Objective-C code directly. We are doing our check in script on application startup. We grab the Info.plist, and check for the key\value pair mentioned in the following link...

    http://thwart-ipa-cracks.blogspot.com/2008/11/detection.html

    If anyone else has any ideas, I think this behooves us as a community to come up with something. My hope for using this approach is at least that it makes our app not a 'drag and drop' hack, and that they might have to pay us special attention that they don't find worth the time to do. I know it was like getting kicked in the nuts to see our hard work downloadable for free hours after it hit the appstore.

    It would be nice if some built in check for player settings was available that did this simple check for you as a Unity build option that generated this check or something more sophisticated into the resulting Xcode obj-c project.
     
  9. ReJ

    ReJ

    Unity Technologies

    Joined:
    Nov 1, 2008
    Messages:
    359
    Btw, people don't forget to send a bug/feature/improvement/whatever request to Apple about pirating. Especially if you know that your game was pirated.

    It is Apple's responsibility in the first place to protect apps from hacking/pirating. Otherwise there is no reason in complicated signing procedures, sand-boxing and disallowing to run self-modifying (read JIT in case of Mono) code or run-time scripts.

    Make sure their understand scale of pirating and potential damage (to their business as well).
     
  10. Jehsup

    Jehsup

    New Member

    Joined:
    May 22, 2008
    Messages:
    166
    I agree it is Apple's responsibility to protect developers whole heartedly, but I question their burning desire to do so while they are still selling so many new devices. For each new device sold, developers make money from legal copies of their work sold on iTunes, and they (Apple) get 30% of that, and Apple gets free device content for new purchasers of their hardware when people jailbreak and use pirated .apps. Apple wins either way. The device sales are their cash cow. So I doubt we will see a MAJOR attempt at protecting developers, just small countermeasures with iTunes and iPhone SDK updates that take pirates a week or less to break through. This is why I think we as a community and perhaps Unity at large need to come up with something that at least sets our Unity based apps apart from the easily broken drag and drop to crack .apps.

    What really frustrates me the most is that LARGE sections of potential world market are lost because of the cultural acceptance in certain countries of pirated software, movies, games, etc. You can right off of the bat write off hopes of making any money in the Russian, Asian, and Central and South American markets because .apps are so easy to hack.
     
  11. littlemuggo

    littlemuggo

    Member

    Joined:
    Apr 29, 2009
    Messages:
    8
    Here is the correct path for the .plist in c#.

    string pListPath = Application.dataPath + "/Info.plist";
    pListPath = pListPath.Replace("Data/", "");

    You can get the path from Application.dataPath, but it includes the "Data/" folder and should be removed from the plist path. So, the pListPath.Replace removes this text giving you the correct path for the plist.

    Use pListPath for the correct path to plist.

    Per above from Jehsup, below contains the correct format:
    /var/mobile/Applications/30B51836-D2DD-43AA-BCB4-9D4DADFED6A2/YourAppName.app/Info.plist