Facebook account which isn't mine - ios

My facebook is sorted like this
- (IBAction)fb:(id)sender {
NSURL *facebookURL = [NSURL URLWithString:#"fb://notes/Nike"];
if ([[UIApplication sharedApplication] canOpenURL:facebookURL])
{
[[UIApplication sharedApplication] openURL:facebookURL];
} else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"http://facebook.com"]]; }
}
The problem is, I have an account on facebook application but I wanted it to go to another fb account which is the "Nike" .. it's not!
I checked before this and tried them all, no use
fb://profile – Open Facebook app to the user’s profile
fb://friends – Open Facebook app to the friends list
fb://notifications – Open Facebook app to the notifications list
fb://feed – Open Facebook app to the News Feed
fb://events – Open Facebook app to the Events page
fb://requests – Open Facebook app to the Requests list
fb://notes – Open Facebook app to the Notes page
fb://albums – Open Facebook app to Photo Albums list
Can anybody help?
EDITED
ADDED
- (IBAction)fb:(id)sender {
NSURL *fbURLWeb = [[NSURL alloc] initWithString:#"https://www.facebook.com/nike"];
NSURL *fbURLId = [[NSURL alloc] initWithString:#"fb://profile/15087023444"];
// Check if FB app is installed
if ([[UIApplication sharedApplication] canOpenURL:fbURLId]) {
// If the FB app is installed
[[UIApplication sharedApplication] openURL:fbURLId];
} else {
[[UIApplication sharedApplication] openURL:fbURLWeb];
}
}

Related

canOpenURL returning true for custom URL scheme even if app is not installed

NSString *customURL = #"mycustomurl://";
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:customURL]]) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:customURL]];
} else {
...
}
The app returns true for 'canOpenURL', even if the target app that exposes the custom URL is not installed. This behaviour occurs on both phone & simulator. openURL then silently fails. Any ideas why this is happening/how to catch this condition?
If using an app with SDK 9.0 and up, then you will have to make sure to add the app schemes you want to open in your main app's info.plist:
Without adding the above to the main app's info.plist (change schemes accordingly) canOpenURL will always return NO. Unless using an app with iOS SDK lower then 9.0 then it won't happen.
Also, use the following logic as it is safer:
NSString * urlStr = #"mycustomurl://";
NSURL * url = [NSURL URLWithString:urlStr];
if ([[UIApplication sharedApplication] canOpenURL:url]) {
if([[UIApplication sharedApplication] openURL:url]) {
// App opened
} else {
// App not opened
}
} else {
// Can not open URL
}
Last check I suggest is to open Safari app in the device, enter the app scheme url string in the url field, press enter. Conclude from the result how to proceed.
Ensure that you are using LSApplicationQueriesSchemes instead of URL types
It works well only for LSApplicationQueriesSchemes
This will not work
This will work
This is what i have used to open Uber app if it is installed else open Uber Website
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"uber://"]])
{
//Uber is installed
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"uber://"]];
}
else
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"https://uber.com"]];
}
Do not forget to add this LSApplicationQueriesSchemes in your info.plist file
Like this (the names of the app uber and twitter has been included in this) info.plist screenshot

Call is not going from my ios app to Skype

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.

How to open an https Facebook page from iOS device?

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.

Custom URL link for linked in app

I am trying to open, linkedin app from my ios app. It is getting opened but with the user's home page. I want it to open with some profile. How can i send the profile id or name with custom url.
try this:
NSString *actionUrl = #"linkedin://#profile/52458178";
NSString *actionUrlWeb = #"http://www.linkedin.com/in/chetankedawat";
BOOL canOpenURL = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:actionUrl]];
if (canOpenURL){
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:actionUrl]];
} else {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:actionUrlWeb]];
}

Can't use FaceTime from app

I'm writing an App where you can call a person via FaceTime. My problem is, when I click on my button for the FaceTime-call, FaceTime opens but there is always a message "animStartXXXXXXX is not available for FaceTime." (the XXXX are random numbers). If I then call the same person from the normal FaceTime-app it works.
The code for the FaceTime-call:
NSString *facetimeString = #"facetime://";
[facetimeString stringByAppendingString:contactNumber];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:facetimeString]];
I get the contactNumber by selecting it from the Adressbook from within my App and it works fine with normal calls/SMS.
Does anyone have a solution for my problem?
I don't think PAIR is using FaceTime for video chat.
Since FaceTime API is not available to developers, you should consider using OpenTok iOS SDK.
Here is a excerpt from GitHub site:
The OpenTok iOS SDK lets you use OpenTok video sessions in apps you build for iPad, iPhone, and iPod touch devices. This means you can use OpenTok video sessions that connect iOS users with each other and with web clients.
It is official that you can use Native app URL strings for FaceTime video calls:
facetime:// 14085551234
facetime://user#example.com
Please refer to the link: https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/FacetimeLinks/FacetimeLinks.html
Though this feature is supported on all devices, you have to change the code a little bit for iOS 10.0 and above as openURL(_:) is deprecated.
https://developer.apple.com/documentation/uikit/uiapplication/1622961-openurl?language=objc
Please refer code below for the current and fallback mechanism, so this way it will not get rejected by Appstore.
-(void) callFaceTime : (NSString *) contactNumber
{
NSURL *URL = [NSURL URLWithString:[NSString
stringWithFormat:#"facetime://%#", contactNumber]];
if (#available(iOS 10.0, *)) {
[[UIApplication sharedApplication] openURL:URL options:#{}
completionHandler:^(BOOL success)
{
if (success){
NSLog(#"inside success");
}
else{
NSLog(#"error");
}
}];
}
else {
// Fallback on earlier versions
NSString *faceTimeUrlScheme = [#"facetime://"
stringByAppendingString:contactNumber];
NSURL *facetimeURL = [NSURL URLWithString:faceTimeUrlScheme];
// Facetime is available or not
if ([[UIApplication sharedApplication] canOpenURL:facetimeURL])
{
[[UIApplication sharedApplication] openURL:facetimeURL];
}
else
{
// Facetime not available
NSLog(#"Facetime not available");
}
}
}
in contactNumber either pass phone number or appleid.
NSString *phoneNumber = #"9999999999";
NSString *appleId = #"abc#gmail.com";
[self callFaceTime:appleId];
objective-c ios facetime

Resources