How can I open application from EKEvent - iphone

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

Related

Subscribed Calendar name has the .ics URL when opened from a UIWebView

My iPhone app (supporting iOS 6+) has a web view which lists events with a "Add To Calendar" button for each event. The "Add To Calendar" button is a hyperlink to an .ics file on the server. To make this work, I have modified IIS to use "text/calendar" as the MIME type for .ics files and used the following code in my UIWebView delegate's shouldStartLoadWithRequest: when the request URL contains the ".ics" path extension
[[UIApplication sharedApplication] openURL:ics_url];
When tapping on the "Add To Calendar" button for an event, I get an alert "Subscribe to the calendar "http://blah.com/pathtoics/file.ics"" with 2 buttons Subscribe and Cancel. When I tap "Subscribe", I get another alert "The Calendar "http://blah.com/pathtoics/file.ics" has been added" with 2 buttons "View Events" and "Done". When I open the Calendar app by tapping on "View Events" button, I see the event gets added but the Subscribed Calendar name is the URL "http://blah.com/pathtoics/file.ics"
Two Questions:
Is there a way to modify the alert to say "Subscribe to the calendar event Team Event 1"" i.e., the event name/description instead of the server path to the ics file? If so, how do I do that?
Is there a way to make the name of the Subscribed Calendar to be a description text that I use in the ics file instead of the path to the ics file? If so how?
In the ICS file, make sure X-WR-CALNAME is set to the calendar name you wish to be displayed in the alert and as the name of the subscribed calendar.

UILocalNotification actions and snoozing

I'm working on a custom app for a client and am still relatively new to iOS development. The app involves setting reminders and I'm using UILocalNotifications. Now from my research the action on the notification will always run the app but I'm really hoping someone can correct me on that. Also from what I've read you are limited to the 'View' or 'Close' options. Ideally I'd love to have 3 buttons on the notification and not have to open the app to perform an action.
I'd like a 'dismiss' option, 'snooze' option, and an 'ok' option that dismisses the notification but runs some code in the background.
I came across a notification related question where somebody suggested opening the app with a modal view and presenting the options from there. Possible, just not as clean, I guess.
Any other ideas or is this what I have to do to achieve my desired functionality? If that's the case is there a way to close the app after I've selected one of my options from the modal view?
Thanks in advance.
That is not possible, as the notification is not created by your app but by the system, so you can't customize the appearance of the notification. (also in iOS 5, the user can choose to display the notifications as banners instead of alerts, which would hide any other button than the view and close button, if that were to be possible).
Secondly there is no way to close your app, as iOS is a user centric system, where the user takes the decision on whether to open or close app, and not the app itself.

What's the rule under the displaying UIAlert message "app would like to use your current location"?

In my app I have two tabs. The first tab just controller with some functions.
The second tab has MapView with showUserLocation property YES.
As I know in general UIAlert message "app would like to use your current location" is displayed when app is launching, but in my raw app this message has time when I do the firs tap on my second tab.
Would you clarify me how can I manage this issue?
P.S.Sorry, but I didn't find any info about.
Thanks
It's actually better to only request location access when it's necessary. In many apps, some users might not even use the location-based features. Having it only pop up when they hit the second tab is perfectly fine.

MFMailComposeViewController and cancelling "save" action sheet?

i am using MFMailComposeViewController inside my iphone app. I notice that if i enter any text in the body and then press the cancel button, i am prompted with an action sheet with an option to save/don't save the unsent message. I have two questions:
can I programmatically prevent the "save/don't save action sheet from appearing? MFMailComposeViewControllerDelegate doesn't appear to have anything along those lines
if i do save, where is the mail saved to? i looked in my mail accounts and didn't see anything saved in any of the "draft" folders.
No, you can't avoid the action sheet appearing. It's been added in iOS 4.x to, precisely, avoid tapping on the "Cancel" button inadvertently when writing a long email, which I think it's a good idea.
It is saved in "Drafts" folder of the account used to compose the e-mail (normally, your "default account" as it is registered in the Settings of your device). I've just tried using a couple of apps and it works.

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.