Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

alexmalex021

macrumors newbie
Original poster
May 19, 2015
9
0
I wrote a commandline tool for a jailbroken iPhone.for use settings in this tool i create a info.plist file and embed to the binary file(same tool).
Now i have a question.
How can i read the info.plist data in the same tool?
i test some methods.but not working.like:

id someValue =[[NSBundle mainBundle] objectForInfoDictionaryKey:someKey];


regards
 
First convert info.plist into an NSDictionary:

Code:
    NSDictionary *info = [[NSBundle mainBundle] infoDictionary];

Then you can read it's objects easily:

Code:
  NSString *bundleName = info[@"CFBundleName"];
 
  • Like
Reactions: alexmalex021
Thanks for your answer.

I used your method,but it return Null for my specific key.

i have a simple Info.plist file :
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>reloadTime</key>
    <string>20</string>
</dict>
</plist>

I use this tool for embedding Info.plist to the binary.


Did you test or used your code?

Regards
 
Last edited:
Did you test with commandline iOS tool? in jailbroken iPhone?

Could you add a new key-value pair to the default Info.plist and test it? test with new key and access new value
I cannot access
 
Last edited:
I used a Fat binary.Is that make a problem?

I tested this method for getting __info_plist data,but this method return wrong data and so cannot convert to plist and nsdictionary.
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.