How can I share instagram username? - ios

I am making on Xcode 6.1.1 and application and wanted to have a link that takes you to https://www.instagram.com/naturee/
I added this:
NSURL *instagramURL = [NSURL URLWithString:#"instagram://user?username=naturee"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
[[UIApplication sharedApplication] openURL:instagramURL];
}
form
https://www.instagram.com/developer/mobile-sharing/iphone-hooks/
But it takes me to Instagram application but not a username!
Does anyone know how??

To understand Universal Links, it’s important to first understand deep links.
Deep links are nothing more than the ability to open up an application to a specific piece of app content. It’s akin to linking to a page other than a homepage on a website.
In order to deep link into an app, traditionally a developer had to register a protocol (i.e. instagram:// , twitter:// , facebook:// ) with the operating system when an app is installed. Subsequently, when an incoming request is received on the device to a registered protocol, the operating system launches the associated application, letting it handle the request (link).
This works well enough; however, if a developer has a website mirroring its app content it results in having to effectively manage, maintain, and synchronize two sets of URL schemes, one for the web and one for the app.
Universal Links try to solve this problem by enabling an app to handle incoming https:// requests (regular web requests).
On iOS 9, a user may navigate or click a link to a webpage and if that website is setup to handle Universal Links (and the app is installed on the device), the operating system will intercept the request (without opening Safari if not already open) and pass the request to the associated application.
Universal Links are an easy way to intelligently route web traffic to an application if available. It enables developers to make the app the default place to send web traffic on iOS, using the web as the backup destination if the app isn’t installed.
quoted from this site

You can use Support Universal Links in your application on iOS9.
There is more information on this link
Your code will work if you change ur NSURL by :
NSURL *instagramURL = [NSURL URLWithString:#"https://www.instagram.com/naturee/"];
If you still want to use URL Scheme, there is something wrong with your actual one :#"instagram://user?username=naturee". You can check it by opening safari on your device and past this url scheme. it won't open instagram's naturee's profile.

Related

App not opened programmatically?

I installed Meeseva app on my device. When I try to open it programmatically it's not opening.
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"Meeseva App://location?id=1"]]) {
NSString *mystr=[[NSString alloc] initWithFormat:#"Meeseva App://location?id=1"];
NSURL *myurl=[[NSURL alloc] initWithString:mystr];
[[UIApplication sharedApplication] openURL:myurl];
}
When I opened fb, twitter, google+ and etc... all are opening successfully.
Can any solve this this issue?
App link is
https://itunes.apple.com/in/app/meeseva-app/id1121539928?mt=8
Is there any another way to open installed app programatically?
If your app can receive specially formatted URLs, you should register the corresponding URL schemes with the system. Apps often use custom URL schemes to vend services to other apps.
Hence "Meeseva" app might not have created a custom url for their app. So you can't do anything for it.
As mentioned above the apps which want to provide support for url schema then they have to create a custom URL schemes.
You need to find out what the correct URL scheme of the Meeseva App is. Meeseva App:// does not seem to be a valid URL scheme as it has a space in the middle.
For example the Google Maps URL scheme is comgooglemaps://, not Google Maps://
Usually developers make their URL scheme public in their documentation. However this is a feature that needs to be implemented and apps don't support this "out of the box". If the developer did not implement this, the app can't be opened via link.
Alternatively it is possible that the app reacts on "universal links". That means if there is a website for the app, iOS might ask you whether to open that website in the app or in Safari. In that case you could simply link to the website and let the user decide how the link should be opened. However, again, this needs to be implemented by the developer. If the app does not support universal links either, there's no way for you to open the app at all.

iOS Custom Url Scheme XCode

First of all, I know how to make custom schemes in iOS and I know how to open my app from a website using a javascript setTimeout method.
I have an app that uses custom URL scheme and it is working great. What it does is, it sends a http://testsite.com/QueryStrings message to other users in the contact list (predefined) and on clicking those web links in the sms, these things happen:
Open the link in Safari
Open the app if installed with custom url using setTimeout
If not installed, move to the normal website page
What I wanted actually is to open my app directly from SMS if installed but for that I have to send my custom url scheme in the SMS, that is not an option because if app is not installed then this SMS wont work so a weblink is the only option for now.
Today, I installed SoundCloud and accidentally noticed this thing is that when http:// m. soundcloud .com /... url is sent in an SMS and on clicking the link it opens the app (if installed) directly not the Safari (Strange for me).
So I was wondering how come their app open from a web link without opening the Safari. I googled it around but I couldn't find a solution to my problem. I am attaching a screenshot too from my mobile where press and hold on the link in the messages app give Open in "SoundCloud" option as well. So how SoundCloud registered a http link to be handled automatically in the app. Please help guys
Screenshot of SoundCloud Open
The answer to this problem is using Associated Domains (But after 9.2 we have to use Universal Links to achieve this).
Before Universal Links, the primary mechanism to open up an app when it was installed was by trying to redirect to an app’s URI scheme (registered in the app’s PLIST like so) in Safari. This put the routing logic in Safari, but there was no way to check if the app was installed or not.
iOS 9 Universal Links were intended to fix this. Instead of opening up Safari first when a link is clicked, iOS will check if a Universal Link has been registered for the domain associated with the link, then check if the corresponding app is installed. If the app is currently installed, it will be opened. If it’s not, Safari will open and the http(s) link will load.
Functionally, it allows you have a single link that will either open your app or open your mobile site.
Configure your app to register approved domains
Registered your app at developers.apple.com
Enable ‘Associated Domains’ on your app identifier
Enable ‘Associated Domain’ on in your Xcode project
Add the proper domain entitlement
Make sure the entitlements file is included at build
Configure your website to host the ‘apple-app-site-association’ file
Buy a domain name or pick from your existing
Acquire SSL certification for the domain name
Create structured ‘apple-app-site-association’ JSON file
Sign the JSON file with the SSL certification
Configure the file server
Apple launched Universal Links in iOS 9.0, which moves the app routing into the OS so that developers don’t need to worry about doing the routing in Javascript.
Receiving Universal Link URL in the App
URI schemes received the deep link URL through openUrl in the App Delegate. Universal Links receive their data via a different code path: continueUserActivity. This new delegate method is used for a number of app transitions, ranging from Spotlight to Universal Links, and will likely see a couple more use cases introduced in future OS versions.
Below is a snippet of code that you can use to retrieve the full Universal Link URL that opened the app.
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *))restorationHandler {
if ([userActivity.activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) {
NSString *myUrl = [userActivity.webpageURL absoluteString];
// parse URL string or access query params
}
return YES;
}
Source: https://blog.branch.io/how-to-setup-universal-links-to-deep-link-on-apple-ios-9

Open sayduck in iOS

I want to open sayduck application from my iOS application. I know I need to use URL Scheme register by this application. My problem is that I cant fint this URL. Do you know how I can check if this URL is definded?
There is a URL scheme - but unless you're sure the user has the Sayduck application installed the best approach is to go via safari. openURL:
http://in.sayduck.com/
This will either launch the app, go to the appropriate app store download page for the device or show a web page depending on the device type (desktop/ios/android etc.)
Disclosure: I work for sayduck

Web service for deep linking

This is my first time create an ios application that required deep linking. I need to create a web service for my custom url scheme for ios in order to publish it online. Please give some pointer on regarding which web service i should use or is there an alternative way to create a deep linking for custom url scheme for iOS. Thanks.
You can do it yourself with any server platform - Rails, PHP, Dot.Net, etc.
Here is a very simple PHP snippet. Replace "myappname" with your app's URL scheme. The param/value query is optional - you can use any other text and parse it in your App Delegate's openUrl method.
if (strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone OS') !== FALSE) {
// redirect
header("location: myappname://?key=value");
exit();
}
Client use-cases:
iOS Safari, your app installed - will open your app.
iOS Safari, your app not installed - Safari will complain that it cannot open the link.
Another iOS app, your app installed - will switch to your app.
Another iOS app, your app not installed - same as Safari. However, if the other app is implementing UIApplication's canOpenURL: - it may gracefully take the user to the App Store, but it's up to the other app developer.
Any other device or browser - will continue to render the page, where you can add your html including AppStore links.
If you don't want to create the server code, you can use a tool I created for this purpose. You have it here:
http://www.uppurl.com/
It's mainly a short link tool that checks for user device and give him the right url based on his devices. With this tool you don't need to write any server code and it also takes care of different devices, operating systems and browsers.
Take care of Tal answer as latest versions of Chrome has changed the way to open app and now you need to provide a link in different format, they use something like "intent://..."

URL shemes for apps

I wanted to open Facebook and Twitter apps from my app. I find very simple way like:
NSURL *url = [NSURL URLWithString:#"fb://profile"];
[[UIApplication sharedApplication] openURL:url];
And there are many others url for open different page of Facebook. How can I check if Facebook app exist on iPhone? What happens if the application is not install on device? Now I try to use this method on iOS Simulator but nothing happened. It's bug of iOS Simulator? Only tomorrow I will have chance to check on device.
You can check if a URL would likely open ahead of time using the canOpenURL method of UIApplication.
http://developer.apple.com/library/ios/DOCUMENTATION/UIKit/Reference/UIApplication_Class/Reference/Reference.html#//apple_ref/occ/instm/UIApplication/canOpenURL:
Also! You can pass values for the facebook page you'd like. This Stack Overflow includes a link to a wiki with all the variations:
Launching Facebook and Twitter application from other iOS app
If you know the URL scheme that the other app is using (e.g. fb:// for the Facebook app), you can first ask whether your UIApplication object can open such URLs in the first place, with canOpenURL:. You can use this, for instance, to decide whether to display a link at all, or whether to direct the user to Safari (with a normal web URL) instead.
As third-party apps cannot be installed on the Simulator as far as I know, the only way to test compatibility with them is on an actual device.

Resources