How do I know that I can not call from the device? For example for e-mail: [MFMailComposeViewController canSendMail]
Anything for calling?
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"tel:+123456"]]) {
...
}
This can be used for calling :
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"tel:12125551212"]];
Please refer this link for more:
iPhoneURLScheme Reference
Related
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"App-Prefs:root=Privacy&path=LOCATION"] options:#{} completionHandler:nil];
Try Below Code. It will take to App Specific Settings.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
I had implemented a module for opening Skype app for various modules chat ,call, video call.It was working till iOS 8.
Below is link is followed for integration
https://msdn.microsoft.com/en-us/library/dn745885.aspx
But it stopped working in iOS 9 now.
The below code is just opening the App-store searching Skype even when Skype is installed
BOOL installed = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"skype:"]];
if(installed)
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:#"skype:%#?chat",dataSource[indexPath.section]]]];
}
else
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"https://itunes.apple.com/in/app/skype-for-iphone/id304878510?mt=8"]];
}
Any Alternative for this?Please guide.Thanks
Below i am sharing the image which worked for me.
I added the key LSApplicationQueriesSchemes in Info.plist file for skype
BOOL installed = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"skype:"]];
if(installed)
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:#"skype:%#?chat",dataSource[indexPath.section]]]];
}
else
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"https://itunes.apple.com/in/app/skype-for-iphone/id304878510?mt=8"]];
}
Hi i am new for Ios app in my project i have added the facility for user make call from ios app to skype
for this i have installed skype in my device and when i made call call from my app call not going
What I have tried so far is the following:
NSString * userNameString = #"sarithasai";
NSString* urlString = [NSString stringWithFormat:#";skype://%#?call", userNameString];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
According to the Skype URI tutorial: iOS apps by MSDN your schema is wrong. You should probably use the following instead:
NSString *urlString = [NSString stringWithFormat:#"skype:%#?call", userNameString];
Note that you should check wether or not Skype is installed beforehand which is mentioned in the linked article as well.
To start a chat use the schema
skype:user?chat
To start a video call use
skype:user?call&video=true
Try this code,
BOOL installed = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"skype:"]];
if(installed)
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:#"skype:%#?call", userNameString]]];
}
else
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"http://itunes.com/apps/skype/skype"]];
}
for more detail follow here.
Im trying to open my Facebook app page from iPhone.
Im using this:
[[UIApplication sharedApplication] openURL:[NSURL
URLWithString:#"http://www.facebook.com/(my page name)"]];
Unfortunately, this redirects to https protocol, and because of that the device is unable to open the page.
What can I do to open this page?
pass your Page ID - xxxxxx not the page Name
[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"fb://profile/herepassyourPageID"]];
or
[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"https://www.facebook.com/herepassyourPageID (id, not name)"]];
You are mistaken by using page name instead of page ID.
You should use something like below:
NSURL *facebookURL = [NSURL URLWithString:#"fb://profile/{pageid}"];
if ([[UIApplication sharedApplication] canOpenURL:facebookURL]) {
[[UIApplication sharedApplication] openURL:facebookURL];
} else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#""https://www.facebook.com/{pageid}"]];
}
[If desired]: You should check the availability of installed facebook app to open the page, as shown in the above code sample.
It's possible to open the Game Center app from your own app using:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"gamecenter:"]];
Is there a way to open it on the page for a specific game?
I've tried many different combinations. Judging by iBook's lack of such a feature, the lack of documentation and as I'm sure you've found—the lack of info on the internet—I'm going to say that someone'd probably have to either brute force the URL to figure it out (if it's set up to go to individual apps by URL at all). Here are some I've tried:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"gamecenter:id350536422"]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"gamecenter:us/app/cheese-moon/id350536422"]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"gamecenter:games/"]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"gamecenter:350536422"]];
UPDATE
I combed through the internals of the OS and found out the URL resolution patterns for Game Center:
You'll need to be savvy with regex to use all of them. Here are some I've typed out for you:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"gamecenter:/me/account"]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"gamecenter:/me/signout"]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"gamecenter:/friends/recommendations"]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"gamecenter:/games/recommendations"]];
The example URLs used in Cirrostratus's answer are missing a few bits.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"gamecenter://static.gc.apple.com/me/"]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"gamecenter://static.gc.apple.com/friends/"]];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"gamecenter://static.gc.apple.com/games/"]];
These URLs seem to work for me on iOS 6 and 7. I'm assuming if you were signed into a sandbox Game Center account that you'd have to use sandbox.gc.apple.com instead. I tried to go to a specific game or friend page via /games/game/<id>/ and /friends/player/<id>/ but anything I try for ID doesn't seem to work. For the friends URL I go to a blank friend page.
Even if someone did figure it out, because it's undocumented Apple could change at any time in the future so I wouldn't hardcode a URL like this into an app.
Only use this routine .
- (void)showGameCenter
{
GKGameCenterViewController *gameCenterController = [[GKGameCenterViewController alloc] init];
if (gameCenterController != nil)
{
gameCenterController.gameCenterDelegate = self;
gameCenterController.viewState = GKGameCenterViewControllerStateDefault;
[self presentViewController: gameCenterController animated: YES completion:nil];
}
}