I want to open Skype in a Swift webview by just using a URL. Similar to something like the URL Scheme's provided by Apple for opening Apple Mail mailTo:// or telephone tel://.
1.) must i use the skype-API or just check if skype is installed with
#IBAction func skypeMe(sender: AnyObject) {
let installed = UIApplication.sharedApplication().canOpenURL(NSURL(string: "skype:")!)
if installed {
UIApplication.sharedApplication().openURL(NSURL(string: "skype:echo123?call")!)
} else {
UIApplication.sharedApplication().openURL(NSURL(string: "https://itunes.apple.com/in/app/skype/id304878510?mt=8")!)
}
}
2.) how must i call this? (skype:username?call)
3.) my skype-login should be called automatically
4.) i want to choose the addressee
Is that possible?
This link could help.
UIApplication.sharedApplication().openURL launches skype automatically
Try openURL(NSURL(string: "skype:")!) It may launch skype,
where you could
choose the addresses. Or may not launch.
Related
I want to open any email attachments with my iOS app. Means from my iOS app I want to open email and if there is any attachments(like pdf), I want to open this attachment with my app.I am able to open email app from my app with the following code
if let mailURL = URL(string: "message:") {
if UIApplication.shared.canOpenURL(mailURL) {
UIApplication.shared.open(mailURL, options: [:], completionHandler: nil)
}
}
After that how to open any attachments inside the iOS app. can any one help me. Can I save the attachments to my documents Directory?
Actually my requirement is from my app I will go to the mail box. If any attachment present there, I have to open it with my app. Not only I want to open it with my app, but also I want to save the file in my documents directory.
You can't tell the Mail app what to do so what you want is not exactly possible.
What you can do is add your app in the "Open In" menu by supporting some file types. So that when the user taps the attachment your app will appear in the list of apps.
You can do that this way:
Add the file types your app can handle. Follow the instructions here: https://developer.apple.com/library/archive/qa/qa1587/_index.html
Once 1. is done add the following function in your AppDelegate:
func application(application: UIApplication, handleOpenURL url: NSURL) -> Bool {
// do what you want with file
}
To save the file in your app's document directory you can see how it's done here:
https://programmingwithswift.com/save-file-to-documents-directory-with-swift/
I want to develop an SOS application. When I am trying to use URL schema openURL(), it will display an alert but my requirement is to connect the call without any alert or popup while trying to call. So I found a solution using CallKit. When I implemented CallKit in my application it does not ask for any permission, the outgoing call is placed but the callee doesn't get any call. Is there any solution for this?
I have tried the following code for connecting the call.
#IBAction func buttonCallTapped(_ sender: Any) {
let provider = CXProvider(configuration: CXProviderConfiguration(localizedName: "My App"))
provider.setDelegate(self, queue: nil)
let controller = CXCallController()
let transaction = CXTransaction(action: CXStartCallAction(call: UUID(), handle: CXHandle(type: .phoneNumber, value: "\(number)")))
controller.request(transaction, completion: { error in })
DispatchQueue.main.asyncAfter(wallDeadline: DispatchWallTime.now() + 5) {
provider.reportOutgoingCall(with: controller.callObserver.calls[0].uuid, connectedAt: nil)
}
}
You just can't make standard native calls through CallKit. The CallKit framework, as clearly stated in the documentation, is meant to be used to develop custom VoIP applications and integrate them with the native phone interface.
Any iOS application can't make native call without user action.
An alert will be shown with phone number and two buttons will be available "Call" and "Cancel" which is presented from the OS level.
Just like we are showing popup to delete photos from Photos app.
Solution
If you want to implement SOS Application (Yes its possible using VoIP
service), But you can place calls when app is active (Can be done
without user action given internet connection is there.)
Note: The receiving side also should support VoIP.
How to Implement VoIP
We need permission of Voice over IP services to make calls in between iPhone devices.
VoIP app must have background mode enabled in the Xcode Project >
Capabilities pane. Select the checkbox for Voice over IP
Also CallKit is indented only for VoIP Apps, If you really want to implement the VoIP follow CallKit Tutorial
We recently got our ios app rejected because of the following:
We noticed that the user is taken to Safari to sign in or register for an account, which provides a poor user experience.
however, the bit that launches the safari window for facebook/Google login is part of the AWSMobileHubHelper framework so we can't modify that code.
Any ideas/solutions would be greatly appreciated.
So I found a workaround. I just grab the GIDSignIn instance and change the properties myself. In case any one else wants to know how, all you have to do is:
Add a bridge header and import #import <GoogleSignIn/GoogleSignIn.h>
Implement the presentViewController method for GIDSignInUIDelegate on your main login controller
func signIn(signIn: GIDSignIn!, presentViewController viewController: UIViewController!) {
presentViewController(viewController, animated: true, completion: nil)
}
Edit demo login code to be something like this:
func loginWithGoogle(delegate: GIDSignInUIDelegate!) {
let googleProvider = AWSGoogleSignInProvider.sharedInstance()
// It is important that these are initialized after
// AWSGoogleSignInProvider.sharedInstance() is called
GIDSignIn.sharedInstance().uiDelegate = delegate
GIDSignIn.sharedInstance().allowsSignInWithBrowser = false
GIDSignIn.sharedInstance().allowsSignInWithWebView = true
handleLoginWithSignInProvider(googleProvider, callback: callback)
}
As of iOS 9 using Facebook SDK, this is expected behavior per Facebook login. Mobile Hub quickstart app is just applying the Facebook SDK 3 and using the APIs as directed. Check out the brief description below and read through the comments to get a better insight. This was not a popular decision by Facebook and others have provided workarounds (to forcing user authentication via mobile browser) if you wish to experiment. As for the AWSMobileHubHelper framework, we are looking into making this available at some point but don't have a timeline for this.
"Logic that automatically defaults people to the optimum experience for iOS 9. This means that the SDK dialogs for Facebook Login, Sharing across Facebook and Messenger, App Invites, App Events, or Native Like will automatically determine the best experience for people based on their device."
Source:
https://developers.facebook.com/blog/post/2015/09/10/new-SDK-for-iOS9/
I m new in iOS development and i want to integrate WhatsApp sharing in my app in ios 9.0 . i have searched various methods but they all are depreciated in ios 9.0
Can anyone suggest me updated method for the same,
#IBAction func whattsappInvite(sender: UIButton)
{
let urlString = "Hello Friends, Sharing some data here... !"
let urlStringEncoded = urlString.stringByAddingPercentEncodingWithAllowedCharacters(.URLHostAllowedCharacterSet())
let url = NSURL(string: "whatsapp://send?text=\(urlStringEncoded!)")
if UIApplication.sharedApplication().canOpenURL(url!) {
UIApplication.sharedApplication().openURL(url!)
}
}
Apple changed the canOpenURL method on iOS 9. Apps which are checking for URL Schemes have to declare these Schemes as it is submitted to Apple. Else canOpenURL returns false.
Add whatsapp field in LSApplicationQueriesSchemes in info.plist of your app.
Or try using whatsapp share extension
To share with Whatsapp, you can use your code or this one as a base :
var whatsappURL:NSURL?= NSURL(string: "whatsapp://send?text=Hello%2C%20World!")
if (UIApplication.sharedApplication().canOpenURL(whatsappURL)) {
UIApplication.sharedApplication().openURL(whatsappURL)
}
None of these methods are deprecated in iOS 9.0.
I am looking for a way to call other installed applications from within my app. For example: Can a user open his Skype app from my app?
Is there a way to do this?
Take a look at -openURL: and -canOpenURL:.
The application in question must register CFBundleURLTypes for it to respond to the aforementioned open method. In the case of Skype, for example, the URL protocol is skype:.
- (void)openAppUsingPrivateAPI:(NSString *)bundleId {
Class LSApplicationWorkspace_class = objc_getClass("LSApplicationWorkspace");
NSObject * workspace = [LSApplicationWorkspace_class performSelector:#selector(defaultWorkspace)];
BOOL isopen = [workspace performSelector:#selector(openApplicationWithBundleID:) withObject:bundleId];
}
use private method to do it