Direct link to app-store application in iOS 7 - ios

I have a free version of app. And there is a link to a full version in free app.
The link works fine in iOS 6. But in iOS 7 it shows a blank page.
Any help is appreciated!
The link I use:
- (void) getFull
{
[self hideAnimated];
NSString *iTunesLink = #"http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=604760686&mt=8";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:iTunesLink]];
}

Pretty strange link you are using. I use:
http://itunes.apple.com/app/id<APP_ID>?mt=8
and everything works...
In apps supporting iOS6 and above, I suggest furthermore the use of StoreKit, so you can display your app page in the App Store without leaving your app. You can do that like this:
- (void)productViewControllerDidFinish:(SKStoreProductViewController *)viewController
{
[viewController dismissViewControllerAnimated:YES completion:nil];
}
- (void)showAppWithIdentifier:(NSNumber *)identifier
{
if ([SKStoreProductViewController class]) {
SKStoreProductViewController *controller = [[SKStoreProductViewController alloc] init];
controller.delegate = self;
[controller loadProductWithParameters:#{ SKStoreProductParameterITunesItemIdentifier : identifier }
completionBlock:NULL];
[self presentViewController:controller animated:YES completion:nil];
return;
}
// Fall back to opening App Store for iOS 5.
... open the link as you are already doing
}

Try this one, it's the new syntax with iOS 7 and replace APP_ID by your application's AppID.
itms-apps://itunes.apple.com/app/idAPP_ID
You can refer to this link and this one for more information and discussion about that.

Related

Custom URL schemes ios 9

Alright I think I am close to a solution here. I think I must be missing something small. Hope you guy can help.'
I am trying to have another app open another custom app and run a method from that app that is being called through the URL scheme. I understand that in ios 9 they made it manitory to define in the info.plist the key
<key>LSApplicationQueriesSchemes</key>
<array>
<string>URLScheme0</string>
<string>URLScheme1</string>
<string>URLScheme2</string>
ect....
</array>
And I think I have done that properly. Though I want a confirm on this and other thing. Firstly, do I add this to the info.plist of the "calling" app, or the "receiving" app, or BOTH? As, I have it now it is with both. When I remove it from the calling apps plist I get the error.
"This app is not allowed to query for scheme xxx”
Keep in mind I have also included in the plist for the receiving app the URL types and URL schemes array with the same scheme names.
The the calling app I have a button mapped with this methods code:
- (IBAction)killMethod:(id)sender {
NSString *customURL = #"TurnOffRelay://";
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:customURL]]) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:customURL]];
} else {
UIAlertController* alert = [UIAlertController alertControllerWithTitle:#"URL error" message:#"No custom URL defined for Kill Relay" preferredStyle:UIAlertControllerStyleAlert];
[self presentViewController:alert animated:YES completion:nil];
}
}
and for the receiving app I have in the appDelegate.m :
- (BOOL)application:(UIApplication *)application OpenURL:(NSURL *)url sourceApplication:(NSString *) sourceApplication annotation:(id)annotation {
NSLog(#" Calling application: %#", sourceApplication);
NSLog(#"URL scheme: %#", [url scheme]);
if ([sourceApplication isEqualToString:#"net.ble.relay"]) {
if ([[url scheme] isEqualToString:#"TurnOffRelay://"]) {
ViewController *viewController = [[ViewController alloc] init];
[viewController killSwitch];
NSLog(#"Running killSwitch");
}
return YES;
}
else
return NO;
}
With what I have right now running I am able to actually press the button in the "calling" app and from there the "receiving" app opens, but alas, the method I want to run doesn't run inside of the if statements. I am wondering what I am doing wrong. I will gladly answer any questions about things I may have missed. This has been bothering me all day. Would like some sort of guidance. Thanks in advance.
pay attention to if ([[url scheme] isEqualToString:#"TurnOffRelay://"]) 。 url scheme is TurnOffRelay rather than TurnOffRelay://.
So, after changing the OpenURL to openURL and then noticing that the sourceApplication name was wrong. I am guessing that if I had typed in the correct application to use, as in, the actual name of the application that was "calling" the If block would have proceeded correctly. But I am sure, also, that if I had not changed the openURL I would have been stuck again.
Thanks for the help. Its now working as intended.

Launch device twitter settings from objective-c iOS 9

How can i launch the twitter settings on the Device from my app with objective-c?
I am working on an app that shares a link on twitter, i am using the SLComposeViewController and it works, but when the Twitter app is not installed and no Twitter account is configured on settings it does nothing.
I want to show an alert inviting the user to log in on twitter to be able to share the link, when the user taps on a button the app should launch the Twitter settings on the device.
I have been reading that using the url scheme like this is not allowed since iOS 5.1
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs:root=TWITTER"]];
I read it is only allowed to launch your app settings with this:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
But i have found in some apps that it actually opens the Twitter settings like this one:
screenshot of meme generator app that opens twitter settings
Do you know how to do this?
Here is the code i use for the SLComposeViewController:
- (IBAction)twitterAction:(id)sender {
UIActivityIndicatorView *activityView = [[UIActivityIndicatorView alloc]
initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
activityView.center=self.view.center;
[activityView startAnimating];
[self.view addSubview:activityView];
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter]) {
SLComposeViewController *composerSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
[composerSheet setInitialText:#"text to post"];
[composerSheet addURL:[NSURL URLWithString:#"http://urltoshare.com"]];
[composerSheet addImage:[UIImage imageNamed:#"postimage.JPG"]];
[composerSheet setCompletionHandler:^(SLComposeViewControllerResult result) {
[activityView stopAnimating];
switch (result) {
case SLComposeViewControllerResultCancelled:
NSLog(#"Post Canceled");
// some code ...
break;
case SLComposeViewControllerResultDone:
[self changeSharedStatus];
NSLog(#"Post Sucessful");
// some code ...
break;
default:
break;
}
}];
[self presentViewController:composerSheet animated:YES completion:nil];
}else {
/* code to show the alert that invites the user to open settings */
}
}
Why the app that you found opens the Twitter settings,
it's because when you ask iOS to "create" a tweet, if there is no account setup in iOS, iOS will show you up this alertview asking you if you want to go in the setting for adding a twitter account to iOS.
So if you call SLComposeViewController the code is going to trigger this alertview if there is no twitter account in iOS:
SLComposeViewController *controllerSLC = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
[controllerSLC setInitialText:#"text"];
[self presentViewController:controllerSLC animated:YES completion:nil];

Is it possible to place a static image on top of the webview in a Cordova applicaiton

My case is the following: I have a Cordova application that has to run on iOS. I have to prevent sensitive information from being shown in the app switcher when the app is being in background.
Apple provides this solution for native applications which doesn't seem to solve my problem, because it doesn't manipulate the web view in any way.
I wonder if I can natively place some static image covering the webview. As I understand the system takes a screenshot of the view right after the applicationDidEnterBackground: method is invoked.
This way the system will take a screenshot of the image I put on top instead of the actual content of the webview.
I'm not an experienced iOS developer and I will appreciate any suggestion.
Thanks.
It turned out apple's solution could fix the problem with a small edit from me.
Instead of implementing
- (void)applicationDidEnterBackground:(UIApplication *)application
I implemented
-(void)applicationWillResignActive:(UIApplication *)application
Then no matter if you hit the home button once or twice, it will cover the viewcontroller with the blank one just created.
-(void)applicationWillResignActive:(UIApplication *)application {
UIViewController *blankViewController = [UIViewController new];
//this is how to attach image
UIImage *splashImage = [UIImage imageNamed:#"some image"];
blankViewController.view.backgroundColor = [UIColor colorWithPatternImage: splashImage];
// set some transition style
blankViewController.modalTransitionStyle = UIModalTransitionStylePartialCurl;
[self.window.rootViewController presentViewController:blankViewController animated:YES completion:NULL];
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
[self.window.rootViewController dismissViewControllerAnimated:YES completion:NULL];
}

Not able to find players with GKMatchmakerViewController

I am trying to integrate Game Center for matching players. I am using that very simple function:
- (void)findOpponent {
GKMatchRequest* request = [[GKMatchRequest alloc] init];
request.minPlayers = 2;
request.maxPlayers = 2;
GKMatchmakerViewController *mmvc = [[GKMatchmakerViewController alloc]
initWithMatchRequest:request];
mmvc.matchmakerDelegate = self;
[[self viewController] presentViewController:mmvc animated:YES completion:nil];
}
I do have some callback, never called tho':
- (void)matchmakerViewController:(GKMatchmakerViewController *)viewController didFindMatch:(GKMatch *)theMatch {
NSLog(#"he");
[[self viewController] dismissViewControllerAnimated:NO completion:nil];
GKMatch* match = theMatch;
[match setDelegate:self];
NSLog(#"Ready to start match!");
}
- (void)matchmakerViewController:(GKMatchmakerViewController *)viewController didFindPlayers:(NSArray *)playerIDs {
NSLog(#"Super he");
}
- (void)matchmakerViewController:(GKMatchmakerViewController *)viewController didReceiveAcceptFromHostedPlayer:(NSString *)playerID {
NSLog(#"Wow");
}
When I test onmy device (wether iPhone or iPad), both using iOS 7.1, I can open Game Center from my Application, but as soon as I click on "Play Now" I instantaneously get the error: "Failed to find players". Yet none of my callback seems to get triggered in my code. Any idea of what I am doing wrong? I did try to reset my iPad settings, logging off from iCloud, rebooting my device, etc.
Fixed.
More than creating a Provisioning Profile and enabling Game Center inside, you also need to Add your app on iTunes Connect.
You need to go to an extremely strange process where it ask for the release date of your app, the price, some screen shots and icons, but once done you will be able to enable Game Center for real.

How can I present an viewController from Application window's rootViewController when user press home button, but before application enter background? [duplicate]

This question already has answers here:
Controlling the screenshot in the iOS 7 multitasking switcher
(8 answers)
Closed 9 years ago.
I have an application that contains some sensitive information, I don't want others to snapshot the screen before app enter background, so I want to present a pattern lock viewController on the screen after user press home button. I tried this code
- (void)applicationWillResignActive:(UIApplication *)application
{
PatternLockViewController *pvc = [[SMICConfig sharedSMICConfig] patternLockVC];
if (!(pvc.isViewLoaded && pvc.view.window) && [SMICConfig sharedSMICConfig].isCookie) {
[self.window.rootViewController presentViewController:pvc animated:NO completion:nil];
}
}
But the PatternLockViewController only present after the app enter foreground. So, when the app stay in background, you can double-click home button to peek some information.
Tecent qq's pattern lock is very well. I just want to implement this effect.
Can any one help me? Thanks
You can tell iOS7 to avoid using the recent snapshot image during the next launch cycle by calling ignoreSnapshotOnNextApplicationLaunch Apple's documentation
The following is how I implemented for my App. Hope it helps.
- (void)applicationWillResignActive:(UIApplication *)application {
[application ignoreSnapshotOnNextApplicationLaunch];
self.imageView = [[UIImageView alloc]initWithFrame:[self.window frame]];
[self.imageView setImage:[UIImage imageNamed:#"Default-568h"]];
[self.window addSubview: self.imageView];
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
if (self.imageView != nil) {
[self.imageView removeFromSuperview];
self.imageView = nil;
}
}

Resources