NSUserNotification() onclick in OS X - swift

How can I make a notification clickable?
I want that when a user clicks the notification on the Mac, Safari opens with the specified link.

To respond to clicks on a userNotification object, you need to implement NSUserNotificationCenterDelegeate's userNotificationCenter:didActivateNotification: method.

Related

How to send sms, detecting text in textview?

I want that when user clicks on certain text,(like call, sms, mail), then corresponding activity should happen ie, when user clicks on call then an action sheet should appear with actions whether you want to save or call etc, similarly for sms and mail.I used textview and gave detection for numbers and email. So for call and mail it is working fine. But how to detect for sms?Because when I give number detection it will automatically show call action sheet ie save or call or cancel.But I want following action sheet, which sms, open, copy, cancel:
I tried using sms//"91123456", but it is not working. I know I can directly launch message picker but do not want this, I want to show default action sheet.I tried this in html and it is working but I want to do in native.
Did you try textView.dataDetectorTypes = UIDataDetectorTypeAll;?
For more data detector types see this UIKit Data Types Reference.

How to Detect if WebView is showing a specific Website on iPhone

I am new in iOS development and trying to make a button called backhome which is only visible when the user tap on the changes the native Website I set in the loadRequest.
Now my question: Is there any way to detect if the user leaves the website I set for e.g in a if statement?
Set a delegate for your "UIWebView" object and then write a method to respond to:
webView:shouldStartLoadWithRequest:navigationType:
The request parameter in that call has a URL and from there, you can tell if the user has left your default website.

How can I open application from EKEvent

Is there any way with which we can open our application when some event in calendar is triggered.
What this actually means is, suppose I create and EKEvent and addAlarm: for this event. Now what I want is when this alarm is triggered I want my application to open, there is no problem is an alert show where user has option like, view & cancel. and when he/she selects view my applications opens, just like local OR push notification.
In view event, display a hyperlink for your application.
Tapping on that link can open your application.
I guess so... Not sure about this...
You can open the event by using Apple Script
See Calendar Scripting Guide
tell application "Calendar"
tell calendar "Project Calendar"
show (first event where its summary = "Important Meeting!")
end tell
end tell

UIDataDetectorTypeAll and popup in app (or at least ask before switching)

Hey guys, I've recently implemented a UITextView into my app, and activated UIDataDetectorTypeAll. Everything works perfect, except when users click on the link, phone number, etc. it automatically kicks them out of my app and into the website, etc. Is there any way to have the website appear in my own app in a custom view, or at least have a popup that asks the user if they want to be taken to the website, call, etc?
Thank you!
Use a UIWebView and message it to load the URL. Wait, that's no help, sounds like you need to intercept the link so you can know the URL. The UITextView may be calling UIApplication's openURL function. This is ugly, but what if you replaced that openURL with your own using categories or subclassed UIApplication and added your own openURL function to override the one at the UIApplication level. Once there, you have a chance to intercept the call and direct it to your own UIWebView or at least pop up a UIAlertView.

show alert in home screen

I would like to make a alertView that can show in any where and don't care there is a View or Window.It just like the safe-model alert can show on the desktop which also can accept user input.
The UIAlertView and UIActiveSheet are build upon a UIView or Window.So I didn't need these kinds.I also know the application called backgrouder has such a alert,but I don't know how to implement it.
You can't. The only way to get your message displayed on the home screen like an SMS is to PUSH this message to the user. Pre condition is that your user has accepted push notifications from your application, and that you're using the Apple Push Notification Service to push info to your users.