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.
Related
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.
I have the following code:
phoneNumber = (NSString*)CFBridgingRelease(ABMultiValueCopyValueAtIndex(phones, i));
NSString *phoneNumberURLString = [[NSString alloc] initWithFormat:#"tel://%#", phoneNumber];
NSURL *phoneURL = [[NSURL alloc] initWithString:phoneNumberURLString];
[[UIApplication sharedApplication] openURL:phoneURL];
However, the issue with this is that, sometimes a certain phone number doesn't get called: for example if phoneNumber is (520) 123-1232, then this doesn't call the phone. Any idea on how to standarize the phone number format such that this method works for all cases?
It is the spaces in the number. A space is not a valid URL character. It must be encoded propery as %20.
I link the following openMap method to a button. The method does work but there is an error message at
NSLog(urlText);
The message shows format string is not a literal (potentially insecure).
Does anyone know how to eliminate this warning?
-(IBAction)openMap:(id)sender{
NSString* addressText = #"New York";
addressText = [addressText stringByAddingPercentEscapesUsingEncoding: NSASCIIStringEncoding];
NSString* urlText = [NSString stringWithFormat:#"http://maps.google.com/maps?q=%#", addressText];
NSLog(urlText);
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlText]];
}
Change the NSLog to,
NSLog(#"%#", urlText);
Or, remove the NSLog completely ;-)
I'd like to make a button call a phone number entered by the user inside the text field. I have a code but it doesn't work.
NSString * phoneNumber = [NSString stringWithFormat:#"%#%#", #"tel://", phoneNumber.text];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]];
Anyone has a similar approach to this? Thanks.
I think it's tel: instead of tel://. See this Apple document. Try giving this a shot:
NSString *pn = [#"tel:" stringByAppendingString:phoneNumber.text];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:pn]];
See my answer to another question for some sample code to handle cases with invalid input.
Basically you do this:
NSString *cleanedString = [[phoneNumber componentsSeparatedByCharactersInSet:[[NSCharacterSet characterSetWithCharactersInString:#"0123456789-+()"] invertedSet]] componentsJoinedByString:#""];
NSString *escapedPhoneNumber = [cleanedString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *telURL = [NSURL URLWithString:[NSString stringWithFormat:#"tel://%#", escapedPhoneNumber]];
Update: I noticed that the string you created shares the some name ("phoneNumber") as the text field from which you try to get the text. You may want to rename either of those two.
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]];
}