Storing app parameters like secret key - iphone

I'm working on a little SDK which has a configFile.plist file to store things like secret key.
Developer who implement this SDK in his app, and other users will download the app, they will be able to go into the app binary and change anything in the .plist file.
Is there any way to store this info without letting users modifing the parameters easily? I don't want users to have the ability to change the parametes in the .plist file.
Thanks in advance for any help!

When it comes to plist storage, it's easily accessible either way. Your best option is to provide a class file for configuration, and not a plist. Example below..
//Config.h
#define SHARED_SECRET #"2390849028349829384"
#define SOME_OTHER_VALUE 1
..and so on, this way, the class file is compiled with the App, and not visible to the user but accessible by the developer. Once you #import "Config.h", you can use SHARED_SECRET and SOME_OTHER_VALUE in place of the value itself within the code. If this suffices as a solution to your question, mark it as the answer. Hope it helps..

Keeping in mind that people are going to be able to see/change almost anything with the right tools, you can't prevent people from hacking this.
If the key is going to be different for each user of the SDK, then you might want to make it the Developer's responsibility and have them provide the private key to you using a delegate method. That will make it their problem, and it will make it easier for them to compile the key directly into code, which is going to be less obvious for the end-user to access.

Related

How do I decompile a .sis file?

I need to be able to view and edit a .sis file. Can anyone suggest the right way to do this please?
Basically, you could indeed extract stuff, modify them and re-pack them. there are tools that can help on this, for example SisContent claims to be able to do so, thus you could use this app at least for viewving the SIS.
Anyhow, the problem there is then the signing. If the app requires capabilities that are ok with Self-signing (and is not having any auto start feature etc.) then you could make own Self-signing certificate, either with the makekeys included in the SDK, or using OpenSSL. With SisContent, there also appears to be Self signing certificate included in it.
Anyhow note that following capabilities: ReadDeviceData, WriteDeviceData, PowerMgmt, ProtServ, SwEvent, SurroundingsDD, Trusted UI, CommDD, DiskAdmin, MultimediaDD, NetworkControl, CommDD, DiskAdmin, MultimediaDD and NetworkControl. Can not be used with self-signing, and as there is no ways on signing apps (and there were never a way on signing others apps) with real Symbian certificate having publicer ID. and thus these apps can not really be installed after they are modified.
Then again, if you are targeting for pre-3rd edition devices, then they are not requiring any signing, thus you could extract the files, modify them, and simply repack with makesis.
There is a software called unmakeSis.

iPhone Dev - Creating a one time UIAlertView like in Temple Run

You know how Temple Run sometimes has alerts when you open the App that appear even though you don't update the App? I understand how you would implement this if you were to submit an update to your App, but how does Imangi implement new alerts without releasing new versions of the App? (I'm assuming they upload it from some server, but I'm an amateur at all of that stuff so could someone sorta vaguely explain how I might go about doing that? Will I need to learn Internet programming languages :O?)
Thanks.
I agree with Jonathan. I would set a plist with a reference number on your server. and it would look something like this. I'm using concept, not code. It would be as simple as hosting it on your server. Or it could be as complicated as your creating a user interface on your website that allows you to just plug in the information and it would create the plist for you.
-(void)checkanddisplaynotificationbasedonupdatedplistontheserver{
int currentnotificationnumber = userprefs preference for item "notification"
get and parse notification.plist from your server
notificationnumber = object at index 0
if notificationnumber > currentnotificationnumber{
display your notification with parsed plist
}
}
You could host a plist online, with an array of alerts stored as dictionaries, with attributes like 'title', 'body' etc. The app would then parse this and to create an alert. You could then set up a method which searches for updates to this file every time the app opens and has connectivity.
This is not the only way - there are probably hundreds of other files types/ automated systems to use, however this is a simple way, and roughly how all of them work, and I have implemented something like this in some of my apps. Hope this helps, if you wan't any help coding it, I will be happy to help!
Jonathan

Equivalent to R in iOS

In android we have the R class that stands for Resources, where we have references to all of our resources and we can easily access them in the code. Is there an equivalent in iOS? I have this doubt because, I want to be able to define multiple files with different values, for instance:
DefaultValuesForViewController1
DefaultValuesForViewController2
Besides creating plist, is there another way (faster and easier like R)?
There is no R class equivalent access method.
In Android, the R class represents access to resources that are consolidated into a native format. iPhone does not do this. Instead, resource files are just copied as is into the application bundle and must be found & opened as such.
You could create a class to store all of your data for the app. iOS generally likes the app to run lean and mean, so only storing your objects for as long as you need them, releasing them as soon as you are done with them. If you were to store everything globally, it would add some overhead, but assuming you don't have a ton of information, it shouldn't be an issue.
There is no equivalent for this in iOS apps. All you get is files that you can enumerate using standard file I/O.
However, you can emulate it partially. Here's a simple demo on GitHub
You can find that SwiftGen(e.g. Tuist used it) can be used as an alternative for autogenerated R.java file on Android
Two point
it is third party source
you have to manually run script after changing your resources

Logging iphone feature usage

Are there any frameworks/services for logging user usage of an iphone application?
Say you want to log events like 'creating a contact' or something similiar, to know how people are actually using your app.
I have used and really like Pinch Media. (Recently renamed to flurry)
http://www.flurry.com
It gives you a bunch of analytics without you having to do anything special.
You can also add hooks to your code to see how often a particular section of code is run and get analytics on that area as well.
Yes, Flurry Analytics does this. You can even pass parameters to your events so you can break down which options are most popular, etc.
What you could do is simply log these messages perhaps as a Log custom class, and whenever you need to add anything to the log, you would simply add a new Log item to the AppDelegate or wherever you need to store the list of Logs. Then you can save them to the file system.
For achieving the logging the feature usage in flurry the url below can be helpful.
http://wiki.flurry.com/index.php?title=Analytics_-_Best_Practices

How to share keychain data between iOS applications

I am describing a problem for which it took me quite some time to learn the answer.
The "GenericKeychain" example is a good start at providing a wrapper for sharing keychain data between applications when using the accessGroup in the init.
However, implementing this in my app yielded an obscure error code (which took forever to locate) -25243, which means: No access control.
I ran Apple's example app (GenericKeychain) on my iPad only to get the same error. Huh?
Does Apple's documentation fail to deliver on what is necessary to accomplish this?
After some (a lot of) digging throughout the web, I found the answer. The access Group that you use when constructing your KeychainItemWrapper class must ALSO be specified in each of your application's Entitlements.plist file in the "keychain-access-groups" section.
It seems almost obvious now that I see "keychain-access-groups". However, I had no idea to even look there. Hope this helps others.
Actually it's not hard to do. Please follow the steps.
App1:
Open your App's target Capabilities and enable KeyChain Sharing.
Add a identifier. (eg : com.example.sharedaccess)
Add "UICKeyChainStore" to your project.
Be sure you have a team id added to your App1 project.
Add Security.framework to your App1 project.
And add these codes to somewhere you need.
[UICKeyChainStore setString:#"someValue" forKey:#"someKey" service:#"someService"];
App2:
Open your App's target Capabilities and enable KeyChain Sharing.
Add a identifier. (eg : com.example.sharedaccess)
Add "UICKeyChainStore" to your project.
Be sure you have a team id added to your App2 project.
Add Security.framework to your App2 project.
And add these codes to somewhere you need.
NSString *string = [UICKeyChainStore stringForKey:#"someKey" service:#"someService"];
Your TeamIDs should be same for both projects.
I tried these steps on a real iPhone device.
I also tried these steps with Automatic and iOs Development provisioning profile.
My apps' bundle identifiers were like that : com.example.app1, com.example.app2.