update page in our app that get data from the net - objective-c

I'm about to release my app (based on the Cocos2d game engine) on the iOS App Store, but I'm worried about updating it - I don't have a facility to send my own data to the app outside of the App Store update process.
I'd like to be able to tell my users "hey, an updated version of this app is available!" or to send other similar messages to users that they'll see when they open the app. For example, I'd like to be able to show the user a "there is a new level available for download" message on the app's launch screen.
How could I add a "remote" scene like this, that will only appear when I want it to, outside of the App Store update process? I'm pretty sure that I need a server that I can have my app talk to - is that right? How complicated would it be to set this up? Are there any guides available?

It's very easy with pictures and text, but DON'T block the user until you've got the response from your server. For example you could write a small python script and run it on Google's cloud service App Engine.

Your 'server side' could be as simple as a piece of text at a given url.
Your client side code will likely want to use NSURLConnection to query the server.

I have a method on my web server that returns JSON with the latest version, and then code in the app as follows:
NSNumber *serverVersion = [dict objectForKey:#"version"];
NSNumber *currentVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:#"CFBundleShortVersionString"];
if ([serverVersion intValue] > [currentVersion intValue]) {
// Out of date
}
Which simply checks the version returned in the JSON dictionary against that in the Info.plist. Where I have my comment block you could have your line of code to display your update scene.

Related

macOS custom urlscheme, do not make app frontmost app?

I have a custom url scheme working well, but there is one small behaviour I am hoping to change... Currently the inbound url is captured and processed in the following code (so, all good here):
- (void) handleURLEvent:(NSAppleEventDescriptor*)event withReplyEvent:(NSAppleEventDescriptor*)replyEvent
{
NSString* url = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
//I parse and deal with the url here//
}
Is it possible to avoid my app becoming the frontmost application? Whenever the url is received, my app is open already, as I initiated the communication from this app, and are merely listening for the reply. However, sometimes the call is made via an NSTimer so my app may or may not be the frontmost app. I don't want to disrupt the workflow if I am currently say browsing pages in Safari by having my app take the focus from Safari. I hope this makes sense.
Is this possible?
For anyone who's interested i instead set up a group container. I save my payload to the group defaults and then send an NSDistributedNotification from my helper app. The main app gets the notification, and reads the payload data from group defaults.
Such a workaround... but its necessary as both the main and helper apps are sandboxed.
I also discovered that KVO on group defaults doesn't work in the sandbox, and neither does sending a userDictionary in the NSDistributedNOtification.
:(
I have had to write sooo much extra code to make my app play nicely in the sandbox.

How can i change the background of my App after it approved and already in App Store

I am new in Xcode and IOS development.
i have designed and finished my app and i connected with Parse for push notification and core data.
the problem is what i didn't understand is: if in future i want to change the background of my app or add new event or to change the palace of button my app, how can i do that? i have to rebuild and submit it again or there is any way to do by online a website like parse?
i couldn't find the answer any where, help please...
Thanks ,
If you had designed your app to load the background data from Parse, then you could just put the new background on Parse and your app would load it. There is no need to submit a new app to do that. If you did it this way, you'd want to have a default background in the case when the network is not available.
You can't add new code to your application with this method (that is not allowed), but you can add data such as images, text, etc. The key point here is that you have to design your app from the start to work this way, then it is simply a matter of putting the new data on Parse where your app can find it.
Expanding on #vacawama's very good answer:
For this version you are out of luck, since it sounds like you did not design it to use a background that is loaded from your Parse server.
What you need to do is to code an update to your app that has these new abilities, and submit that to the app store. Once that version is approved then you should be able to change the background from the server.

Confused with IOS Deep linking

I'll just want to ask if someone here know the step by step process of creating a deep link for an IOS app? I've tried to read some articles but it did not give me absolute answers. Thank you :)
Deep linking is basically just setting up url to your app so that other apps can launch it with information. The can launch to certain parts of the app if you set it up so that your app reacts to certain urls. So there are a few things that you have to do. For this example I will use two apps. If you are trying to integrate with an existing app you just have to find out what their url schemes are. So for this example I will use 'Messages' as one app and 'Schedule' as another.
First: in the 'Messages' app we will need to setup the schemes our Schedule app to call.
So open up your first app we need to add schemes so other apps can open it. Go to your info.plist click the little + and type URL types hit the triangle to expand and hit the + type URL Schemes and within that one add an item and put your apps name in it. Also add URL identifier along with $(PRODUCT_BUNDLE_IDENTIFIER) as the value. `
Then we just have to add the apps that we can open so hit the top level + again and add LSApplicationQueriesSchemes This whitlists the apps so we can evaluate weather or not they are installed on the device.
Now we can jump over to the other app and create a way to call this. For this example lets make it happen when we press a button.
IBAction launchMessagesApp() {
let url = NSURL(string: "Messages://") where UIApplication.sharedApplication().canOpenURL(url) {
self.launchAppWithURL(url, name: "Messages")
}
The canOpenURL(url) checks to see if the application is on the device. If you wanted to you could launch the app store to your app if that retuned false. then launchAppWithURL actually launches it. That is the basic setup you may also want to have multiple things happen so you may have multiple url schemes that launch the same app but take it to different parts of the app. In the app delegate of the app in the function
func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
print(url)
//Any customizations for the app here
}
You can do anything you can imagine.
Have you checked out Turnpike? It's an open source tool for enabling deep linking in iOS apps. http://urxtech.github.io/#GettingStarted
If you want to create a deeplink you might need to do some server code to detect the user device/browser and do some actions based on this.
I've created a tool that simplify this process, you can check it here:
http://www.uppurl.com/
It's mainly a short link tool that checks for user device and give him the right url based on his devices. With this tool you don't need to write any server code and it also takes care of different devices, operating systems and browsers.

Custom sounds for local notification in iphone, but using the build in sounds

I am setting up a local notification and I am using:
// other code to setup myNotifyAlarm (omitted)
myNotifyAlarm.soundName = #"Glass.aiff";
[app scheduleLocalNotification:myNotifyAlarm];
(code found in many sites as an example on how to set a local notif.)
But I get the sound set in the Settings->Sounds->Text-Tone not Glass.aiff.
I tried to replace the #"Glass.aiff" with the .caf sounds (from http://iphonedevwiki.net/index.php/AudioServices), no luck there either.
I don't want to include "my own" sounds, the iPhone (and other iDevices) have a lot of build in sounds that I could use. The question is how?
(I want to give the user an option to choose a different sound for each notification alert (my app has 4 "types"), so I need a way to change the sound... something like a personalized ring-tone for notifications)

Swap the application in Objective-C?

I'm developing iPad application I need to integrate third party project(Source code) with my code like i have a button in my code, when i click on the button it landed to third party application page then navigate around and vice verrsa. what is the best way to swap the app?
Regards,
Sri
Use the url schema.
See add custom URL Schema using http://
Every Application can have customer url schemas. Like ...
yourapp://someting?withparams=1.
To get they running you have to change your Info.plist to inform the iOS that your app is handling that url schema. See the SO post above.
When another App calls that URL your app gets opened and you get a hook on your app delegate.
check http://developer.apple.com/library/ios/#featuredarticles/iPhoneURLScheme_Reference/Introduction/Introduction.html#//apple_ref/doc/uid/TP40007899
and:
http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intf/UIApplicationDelegate
Also look here:
http://wiki.akosma.com/IPhone_URL_Schemes