iPhone Linking to an iTunes page - iphone

I found a page (http://itunes.apple.com/linkmaker) to get the iTunes url for a specific page which I assume should direct the user out of my app and into the corresponding page in the app store.
I have never done this or any other UIWebView stuff but after some searching I found some code that I thought would work that uses UIApplication.h.
My code is:
#import <UIApplication.h>
//...in a tableView....
case 8:
- (BOOL)openURL:(NSURL *) http://itunes.apple.com/us/app/lockbox-pro/id288460603?mt=8&uo=4;
break;
openURL has an error saying that it is undeclared - but I imported the UIApplication.h file. Then I saw that the UIApplication import also had an error on it. I don't think that I want to use UIWebView because from what I understand, that opens up the URL in the app itself - I want to direct the user to the App Store. Where am I going wrong?
EDIT: Okay, I changed it to a simple button that is supposed to close the app and bring the user to the itunes page:
- (IBAction) pressedFull {
[[UIApplication sharedApplication] openURL:[NSURL urlWithString:#"http://www.google.com"]];
}
I linked it in IB - it still crashes the app when the user clicks on it.

Your code has a number of things wrong in just one line. First, you're typing the method signature rather than using the method properly (ie, sending a message to an object). Second, you're not enclosing the string.
Try this:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"http://yoururlhere"]];
With respect, you should review the Learning Objective-C: a Primer thoroughly until you are more comfortable with the syntax as well. A quick look at some of your other questions suggests this is your biggest issue. You'll be doing yourself a huge favor by setting all else aside and concentrating on getting Objective-C well and truly under your belt before continuing.

Related

Link to iTunes Ratings Page

What's the link to the ratings page on iTunes for my app?
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"???"]];
This other question has an appropriate answer. Note that the type=Purple+Software part is literal and not the name of your company. The only thing you need to change is the app id. This example is a little strange in that the string is broken up into several strings, I would just use one for the format to substitute the app id.
The end result looks like this:
itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=123456789
after iOS7 #Jon Steinmetz link deprecated. so, you should write a code divide os version as follows.
if([[UIDevice currentDevice] systemVersion].floatValue >= 7.0f)
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:#"http://itunes.apple.com/app/id%#", #YourAppID#]]];
else
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:#"http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=%#&pageNumber=0&sortOrdering=1&type=Purple+Software&mt=8", #YourAppID#]]];
Creating a rating link could become a complex issue when supporting multiple OS and multiple platform. For example the WebObjects isn't supported on iOS 7 (some of them), some links you create would open another country store then the user's etc.
There are 2 related open source libraries that could help you:
iLink - There the link would be found at run time (the library would check the app ID and the OS it is running on and would figure out what link should be created). The best point in this is that you don't need to configure nothing before using it so that is error free and would work always. That's great also if you have few targets on same project so you don't have to remember which app ID or link to use. This library also would prompt the user to upgrade the app if there is a new version on the store (this is built in and you turn this off by a simple flag).
Copy the 2 library files to your project.
On your appDelegate.m:
#import "iLink.h"
+ (void)initialize
{
//configure iLink
[iLink sharedInstance].globalPromptForUpdate = YES; // If you want iLink to prompt user to update when the app is old.
}
and on the place you want to open the rating page for example just use:
[[iLink sharedInstance] openRatingsPageInAppStore];
and import iLink.h on the same file.
There is a very good doc for the whole library there and an example projects for iPhone and for Mac.
iRate - This library is super recommended if you want the library to prompt the user rating process automatically. Just set the parameters you want and it would do the work for you (also have translations for lots of languages). The downside is that you would use an alert view for that and not your own UI.

How can i make phone calls from my application?

i want to make an application which makes phone calls.i am new in this field.Please give some guide lines.
The URL scheme format (according to the Apple URL Scheme Reference) is tel: NOT tel://. While the latter works now, it is not consistent with Apple's documentation and may not work in the future. Aside from that detail, Noah's and mihirpmehta's suggestions are the correct way to initiate a phone call from within your app. Keep in mind though, that your app will quit when the phone app is launched so you may want to save state before opening the URL.
use
[[UIApplication application] openURL:[NSURL URLWithString:#"tel://8005551212"]];
It will only work in iphone... not in simulator...
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"tel://5558675309"]]

How to programmatically exit from an iPhone application?

I have an iPhone application which will exit on it's own after a user completes a particular action. I currently use exit(0) to leave the application and I have had no troubles with it until recently. I understand that this isn't the "right" way to exit an application but it is something that I want to do. The issue I am having is when the device awakes from hibernation, with my application as the active one, exit(0) is called and the application would restart after exiting.
This strikes me as quite odd and am wondering if this is a bug or am I doing something wrong? Is there a better way to gracefully exit an application without having the user hit the home key?
Thanks
Apple's way is to alert the user that the app is finished and they must click home to quit. You shouldn't do this in your code. If its obvious that your app is quiting to reviewers then it most likely won't get approved.
You can use this private command to quit your app with an animation (after you added the UIApplicationExistsOnSuspend key in your Info.plist) :
[[UIApplication sharedApplication] suspend];
But your app will be rejected if you want to put it in the App Store
There is a link here where may be have your answered: link text
But it doesn't exist public API to terminate programmatically your iphone application. (see Technical Q&A QA1561 from the iPhone Dev Center)
I see the same issue. I was able to stop this by calling exit(1) instead.
//#step invoke the normal routine applicationWillTerminate
if ([[UIApplication sharedApplication].delegate respondsToSelector:#selector(applicationWillTerminate:)])
{
[[UIApplication sharedApplication].delegate performSelector:#selector(applicationWillTerminate:) withObject:[UIApplication sharedApplication]];
}
//#step force quite app
kill(getpid(), SIGINT);
I think that is no private API was used ....

How to find a call is unanswered in iphone

If i make a call from an application using
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"tel://1234567890"]];
How can i check if the call is answered or unanswered
Thanks,
You cannot check this. When this URL is opened your application will be closed and phone app will be launched. Since you cannot access calls data from your app there is little you can do. This may be possible in jailbroken iPhone.
Pop up a dialog when the app re-opens asking the user if the call went through. You better have a good reason for wanting to know though or the user will be mighty annoyed!
Otherwise you are out of luck.
Not an iPhone app developer but is it possible to query the phone log the next time the app loads and check time on call or something and if it is over 20 seconds consider it completed or something like this?
There is no access to the iPhone phone from third party software. Luckily.
you can reffer
How can I check missed call in iPhone using Objective-C?

How do you prompt the user to rate your iphone app without waiting for them to delete the app?

I am referring to the popup window that asks the user to submit a review/rating.
I know it can be done since the Aardark app does it...it asks several times in fact! (Almost too spammy.) But there has to be an API to trigger the rating request? Google is giving me no love on this one.
I would check out the Appirater project that Arash Payan has put together.
Pretty much handles the checking and displaying of the "rate my app" prompt, and brings the user right into the review portion of your app on the App Store.
It's a very clean, and elegant way to provide that minimum barrier so that your users are more likely to submit reviews of your app.
Hope this helps...
I have written about a way to open right into the review panel of the App Store.
http://www.memention.com/blog/2009/09/03/Open-Reviews.html
The actual code part if called through a button press could look like below
- (IBAction)gotoReviews:(id)sender
{
NSString *str = #"itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa";
str = [NSString stringWithFormat:#"%#/wa/viewContentsUserReviews?", str];
str = [NSString stringWithFormat:#"%#type=Purple+Software&id=", str];
// Here is the app id from itunesconnect
str = [NSString stringWithFormat:#"%#289382458", str];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
}
I wrote a library to do this - similar to Appirater but a bit more configurable and with Mac App Store support:
https://github.com/nicklockwood/iRate
I have discovered the most subtle value of S.O. (already obvious to all elementary school teachers) --- often by simply forming your question, your neurons rearrange and you are more successful at answering it yourself! (Either that or Google optimized my search after spying on my keystrokes and indexing my question on S.O.)
Answer found after more productive googling:
http://www.mobileorchard.com/fighting-back-against-the-app-stores-negative-rating-bias/
this may not be what youre looking for EXACTLY but what i would do is just prompt them in the app somehow and somewhere not too annoying with a button or alert view and have that button link them to app url in safari which opens the appstore to your app. you can use the url http://www.itunes/apps/ (your app) as i believe is the synthax. i cant remember the exact code but i can get it for you if need it.
We AskingPoint have another way to do it (Im a founder) that provides BOTH App Analytics and the rating widget. You can adjust server side settings based on your analytics to prompt only your best users. Change settings on the fly. And it's translated into over 30 languages.
I wanted to do this when I roll the app out for the first time... looks like I'll have to wait and put it out as an update to ensure that it will work... let me know if I am wrong and there is some way I can test this before submitting to apple for distribution.