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

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

Related

Setting a value in Frappe application isn't reflected in ERPNext GUI

I have added a 'number_of_members' value to the Customer DocType via customization.
In my application I have tried several ways to update the value. However the value never updates in the webpage. I feel like I'm missing some sort of save or update or commit step.
For example I have tried:
frappe.client.set_value('Customer', '00042', 'number_of_members', 8887)
frappe.set_value('Customer', '00042', 'number_of_members', 8887)
frappe.db.set_value('Customer', '00042', 'number_of_members', 8887)
and also
customer = frappe.get_doc('Customer', '00042')
customer.number_of_members = 8887
customer.save()
In each case I can do something like frappe.get_value, or frappe.get_doc and it shows the value is set to 8887. However it never updates in the web side. This is what makes me think I'm updating some sort of cache or database transaction and I need some way to save it, but have not had any luck.
I am mostly testing this via bench console if that has any bearing on it, but I've tried a couple of the methods in my application code as well.
Relevant documentation:
Frappe Developer API - Document
Frappe Developer API - Database
Turns out the answer is to call frappe.db.commit() after making changes. If someone can point this out in the documentation so I can better understand how I'm missing stuff, I would appreciate it.
I also noticed if you try to Save something in the UI before you send frappe.db.commit() the UI will hang.

Storing app parameters like secret key

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.

Add calendar to iphone

I am currently making and iphone app and a big function that i want to incorporate is the ability to subscribe to a calendar..
what i wish to do is to let the user give a URL for where the calendar is held, and from that url i want the app to fetch that calendar and subscribe to it..
i want to know how i can write the code to do this..
so in short my question is..
what code would i write to:
get .ics file from a URL
and save/subscribe to this newly
fetched .ics calendar file
any help and info would be very much appreciated..
The idea of "subscribing" to something isn't a build in function of the iOS SDK. To get this type of functionality would mean writing a recurring/timed function to grab the contents of this URL and process it locally.
The library I often use to simplify some of the HTTP functionality that you'll need is asi-http-request
https://github.com/pokeb/asi-http-request/tree
Hope this is helpful.

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

What is the best way to find localizable strings in an xcode project

So,
Now the time has come to go back over an old iPhone project to localise it and I am confronted by ploughing through an entire project looking for user facing strings. Is there any crafty way of doing this short of searching for #" and checking every instance?
Looking at the Apple localization documentation there does seem to be mention of running a cocoa application from the command line with NSShowNonLocalizedStrings set but I'm not sure if that is applicable to the iPhone. Also it would seem that all this option actually does is print the strings to the console as you come across them in the app, so that means exercising every scenario the app could encounter including error conditions etc. Not ideal.
Change your Localizable.strings file so that every entry looks like this:
/* Please Login */
"Please Login" = "XXXXX";
/* Error */
"Error" = "XXXXX";
Now use the application and look for any string which is still readable. They're the ones you still need to localize.