iOS open with specific apps - ios

I'm trying to show apps from UIDocumentInteractionControllerDelegate , default apple apps like; sms, email or UIPasteBoard (Facebook and Twitter is optional) . Just like the similar of Dropbox app :
How can I handle this kind of situation? I've done already open apps from their UTI's, open just email or just sms but I don't how to show all of them in one sheet.
Thanx

I believe you're looking at an UIActivityController instead of a UIDocumentInteractionController, which I believe Apple is trying to phase out.
Check out the docs here https://developer.apple.com/library/ios/documentation/uikit/reference/UIActivityViewController_Class/Reference/Reference.html

You should try QLPreviewController. This will give you desired result.
https://developer.apple.com/library/ios/Documentation/NetworkingInternet/Reference/QLPreviewController_Class/Reference/Reference.html

Related

Set your app to detect and open when a specific link is clicked - Xcode, Swft 4

I'm currently working on an iOS app, Swift 4, that automatically launches on click of a link to block users from accidentally navigating to that link.
How would I set this up?
For example, YouTube opens up youtube.com links.
Sorry if this is a vague question, if more info is required feel free to ask ^^
If you create a custom URL protocol like myapp://somepath (where myapp is the protocol) then you just register that custom protocol, and when the user clicks such a link it’ll automatically open your app. You can’t intercept a general purpose URL protocol like HTTP or YouTube.
(At least not without OS support. That's how YouTube and the app store are able to open HTTP links.)
I haven't done anything like this so far but it seems like you should take a look at Apple URL Scheme and Universal Links:
https://developer.apple.com/library/content/featuredarticles/iPhoneURLScheme_Reference/Introduction/Introduction.html
https://coderwall.com/p/mtjaeq/ios-custom-url-scheme
https://developer.apple.com/library/content/documentation/General/Conceptual/AppSearch/UniversalLinks.html
https://www.raywenderlich.com/128948/universal-links-make-connection?utm_source=raywenderlich.com%20Weekly&utm_campaign=95f29cf4fc-raywenderlich_com_Weekly5_31_2016&utm_medium=email&utm_term=0_83b6edc87f-95f29cf4fc-415182745

Show preview of URL while entering a link in UITextView

I need to show a preview of a URL (like FB and WhatsApp do), while the user is entering a link in a UITextView.
Is there a library on iOS to grab it, or do we have to make our own?
Thanks in advance.
iOS does not provide this functionality by default.
You will have to build your own or use an open source solution.
This project might provide what you need:
https://github.com/itsmeichigo/URLPreview

Get referrer string for Universal Link?

I implemented Universal Links in our iOS 9 app and they work by calling a method in AppDelegate.swift, in which I get an NSUserActvity with an URL attached to it.
Is there a way to get the (HTTP-) referer? I need to know on which website the user has tapped the link that opened the app.
You should be able to use NSUserActivity > referrerURL instance property. See https://developer.apple.com/documentation/foundation/nsuseractivity/2875762-referrerurl.
No, there is no way to get the referrer.
An Apple employee made that pretty clear on the developer forums: https://forums.developer.apple.com/thread/65423
They say that the only way to get some kind of referrer would be to append it to the URL. Maybe take a look Google's campaign tracking URLs (utm_...).
I found another interesting solution if you need to support iOS 9 and 10 - https://appmetrica.yandex.com/blog/referrer-based-tracking-dlya-ios-tochnaya-atributsiya-dlya-lyubogo-istochnika-trafika.
Since iOS 11 I guess can be used NSUserActivity > referrerURL.
In short:
SFSafariViewController uses the same cookies as Safari app.
You can open invisible SFSafariViewController inside your app.
If your site contains some cookie - use Universal Link to pass it back to the app.
Though it requires to implement something like tracking link on your site.

Link to open up iOS app from facebook and twitter page and other ios app?

Hi I have a requirement in my app. From my ios Application(myapp),i share a link to facebook. Then I opened up my facebook account in browser or Facebook application and clicked the link, link should open in myapp if myapp is installed in the device otherwise link should open in browser. How can I achieve this ? Please suggest me step by step. Thanks in advance for your consideration and help.
I am not sure if this is possible. I have looked at various questions including
Is it possible to register a http+domain-based URL Scheme for iPhone apps, like YouTube and Maps?
as I am sure you might have already done but these questions target their own app, mainly web app, but you want that behavior to occur from an app that is not yours like twitter or facebook. But what you can do is show them two links on facebook/twitter, if they have installed press link 1 and if they want to install, press link 2 and you can pass parameters in link 1 as you might already know.
I will also keep checking answer of this question if some one comes and gives a better solution.
There is an option called custom URL scheme in iOS. It will help you to create a URL scheme which identifies your application. You can post link with this URL scheme and when you tap on this link on your iOS device it will open up your mobile app. Please see the link below to know how to setup this.
Custom URL Scheme in iOS
This is called 'deep URL linking'. Facebook have built a service called 'App Links', which seems pretty cool.
https://developers.facebook.com/docs/ios/app-links

iPhone development - Viber integration

Somebody knows how to send a message through Viber inside my app?
I've been trying send:
viber://[local] (ex. viber://63648018)
viber://[domestic] (ex. viber://08963648018)
viber://[international] (ex. viber://+498963648018)
with no success.
Any idea?
Unfortunately there's no such option available in Viber since version 5.6, according Viber's support.
You can share a message, using Viber, but you can not send it to a specific user: you'll be prompted to select one in you user's list.
The URL scheme is:
viber://forward?text=foo

Resources