I am having an app in which I have a button to "Rate" the app.
On click of the button, I am using the following code.
- (IBAction)ratePressed:(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:#"%#appid", str];
NSLog(#"str is %#",str);
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:str]];
}
My App is not on the app store so when i Pressed the rate button it gives me an error saying
Your request produced an error.
[new NullResponse]
When I put the appid of of an app that is actually on the appstore. It works fine.
So can I put the custom message saying "app is currently not available"? when the app is not on the appstore. Or is it a default message by Apple?
Please help me.
Related
There is an iOS 5.0+ app, released in App Store, which displays employees profiles with their phone numbers. The users of the app can tap on the phone number and the number will be dialed on their iPhones.
The problem is that some users with iPhone 4 are reporting that it does NOT dial.
This is the code I am using to dial:
NSString *cleanedString = [[self.member.phone componentsSeparatedByCharactersInSet:[[NSCharacterSet characterSetWithCharactersInString:#"0123456789-+()"] invertedSet]] componentsJoinedByString:#""];
NSString *escapedPhoneNumber = [cleanedString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *urlText = [NSURL URLWithString:[NSString stringWithFormat:#"tel://%#", escapedPhoneNumber]];
[[UIApplication sharedApplication] openURL:urlText];
Any ideas about this?
There shouldn't be any / in the tel: scheme:
NSURL *urlText = [NSURL URLWithString:[NSString stringWithFormat:#"tel:%#", escapedPhoneNumber]];
In the Apple URL Scheme Reference you can see some example for what is allowed in the tel: scheme.
If you use telpromt instead of tel this will return you to app after your call ends|
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"telprompt:1234567890"]];
i am working on signup feature. In this feature when the user create account successfully. i am asking him or her to activate his account.
i want to open the mail application of iphone if user say yes.
now my question is simple how to open mail application from my own application?
#define URLEMail #"mailto:sb#sw.com?subject=title&body=content"
NSString *url = [URLEMail stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding ];
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: url]];
Try this out.
-(void)launchMailAppOnDevice
{
NSString *recipients = #"mailto:myemail#gmail.com?subject=subjecthere";
NSString *body = #"&body=bodyHere";
NSString *email = [NSString stringWithFormat:#"%#%#", recipients, body];
email = [email stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:email]];
}
stringByAddingPercentEscapesUsingEncoding and openURL are deprecated.
Now use this:
#define URLEMail #"mailto:sb#sw.com?subject=title&body=content"
NSString * encodedString = [URLEMail stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]];
UIApplication *application = [UIApplication sharedApplication];
[application openURL:[NSURL URLWithString: encodedString] options:#{} completionHandler:nil];
Ahoy!
The long and short of it is; you can't.
You can create an email compose view for the purpose of sending emails (see MFMailComposeViewController), but you cannot open applications arbitrarily without a purpose.
See this previous post for clarification: Launch an app from within another (iPhone)
Really though, it's not much effort for the user to close your app and open Mail so I wouldn't worry too much about it anyway.
I have this code in a button click for ratting this app
-(IBAction)_clickbtnratethisApp:(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]];
}
but nothing happens when I click the button,my need is I want to set a alert view to show like the ordinary alert like ratethisapp,nothanks,later.If I tap the ratethisapp I will redirected to the ring page of appstore.How to active this?Thanks in advance.
The itms-apps: URL syntax doesn't work on the simulator but works fine on the device, so that's probably the only thing wrong with your code and if you try it on a device it will work fine.
Unrelated tip: You can concatenate strings using the stringByAppendingString: and stringByAppendingFormat: methods, that will save some code versus the way you are building your string currently.
I have seen that some apps have a option for the user to rate their app from within the app. Anyone here knows how to do that?
Thank you
Søren
I wrote about it in a blog post here. The user will be taken to the App Store app and I don't believe you will be able to do all from within you own app.
This is the gist of it
- (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]];
}
here is my code:
-(IBAction)itunesBuy:(id)sender{
// NSString *urlString = [[NSString alloc] initWithFormat:#"http://itunes.com/%#/%#", self.artistTerm,self.titleTerm];
NSString *urlString = [[NSString alloc] initWithFormat:#"http://phobos.apple.com/WebObjects/MZSearch.woa/wa/advancedSearchResults?albumTerm=%#", self.titleTerm];
NSLog(#"urlString=%#", urlString);
NSString *escapedValue = [(NSString *)CFURLCreateStringByAddingPercentEscapes(nil,(CFStringRef)urlString,NULL,NULL,kCFStringEncodingUTF8) autorelease];
NSURL *itunesUrl = [NSURL URLWithString:escapedValue];
if (![[UIApplication sharedApplication] openURL:itunesUrl])
NSLog(#"%#%#",#"Failed to open url:",[itunesUrl description]);
}
You can see that I tried the simpler itunes link as well. My understanding was that this won't work on the simulator, but should on the device.
On my iPad and my iPhone, it launches itunes, but then I get an error saying:"Your request could not be completed. This search cannot be performed on this device."
Any help would be appreciated.
Steve
There is no advanced search in device appstore, only in itunes on your Mac/PC.
Try to use the simple search with "itms://phobos.apple.com/WebObjects/MZSearch.woa/wa/search?term=%#".