iOS: Event Kit with custom event source (from web/ICS)? - iphone

I am looking into using event kit to display calendar events to our users, but I am trying to find a way to source the events from our website, since we already have thousands of events in our system.
Is there a way to have event kit use a .ics file from the web as a source? Or any other way to pull the data from another server?

Actually there is, and it is quite simple...
Create an IBAction and use the following code:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"http://addressToYourics.ics"]];
And that it is. There will be an confirmation if the user wants to set the new calandar, and thats it.

Related

Implementation of WhatsApp/Telegram like calling feature in Flutter

How can I implement WhatsApp/Telegram like call notification when the flutter app is in the background or cleared from the recent task (clearing ram)? Can anyone let me know Exactly How to do this?
There is a great youtube series on this exact topic. In the series, a YouTuber by the name of the CS Guy creates a clone of Skype. I've placed the link to the video where he explains how to create a pop-up screen when a user calls another user, however, you may need to watch the previous videos within the series in order to get everything working. Its quite long but I recommend you watch the entire thing. In terms of displaying notifications when a user is called, I recommend you watch a video by Fireship listed below. In the video, he explains how to send notifications in the background when a certain event occurs in Firestore.
I can't explain the entire process in detail to achieve what you want but I can give a general overview of what you would need to do.
Watch the video/entire series by the CS Guy and complete everything
Learn how to send push notifications in firebase from Fireship
When a new document is created within the calls collection (You will understand once you finish the cs guy series) trigger cloud function.
Find the uid of the receiver of the call within the cloud function and grab the user's token from Firestore.
Finally, send a notification to the receiver telling them about the incoming call.
CS Guy:
https://youtu.be/v9ngriCV0J0
Fireship: https://youtu.be/2TSm2YGBT1s
I have done the exact same thing in my application and can help you out if you need further assistance, however, please go through both videos/series first.
You can use the flutter_local_notifications plugin with the firebase_messaging plugin.
From the documentation of the flutter_local_notifications plugin;
[Android] Support for the following notification styles
Big picture
Big text
Inbox
Messaging
From the documentation of the firebase_messaging plugin;
With this plugin, your Flutter app can receive and process push notifications as well as data messages on Android and iOS.

objective c - how can i open ics files on iphone

I have built an app for week numbers, and I have made an ics file with week numbers in, but how can I open it with Objective-C so it will subscribe into calender?
I can't figure out how I can do this. Are there any frameworks I can use, or what?
I have tried:
NSString *ical = [NSString stringWithContentsOfURL:
[NSURL URLWithString:#"http://xxxxxxxxxxx.xx/apps-iphone/weeknumber/ical/ical.ics"] encoding:NSUTF8StringEncoding error:NULL];
but I can open it with that.
It needs to look like this:
Hope you understand me. :)
I'm pretending that you have the .ics file inside your app, right? And with this .ics file you want to open the Safari and have the alert?
Take a look at EventKit framework. You can integrate your app with the user's calendar. From EventKit's programming guide:
Event Kit not only allows your app to retrieve users’ existing
calendar and reminder data, but it also lets your app create new
events and reminders for any of their calendars. In addition, Event
Kit lets users edit and delete their events and reminders
(collectively known as “calendar items”). More advanced tasks, such as
adding alarms or specifying recurring events, can be achieved with
Event Kit as well. If a change to the Calendar database occurs from
outside of your app, Event Kit is able to detect the change by
notification so your app can act appropriately. Changes made to
calendar items with Event Kit are automatically synced to the
associated calendar (CalDAV, Exchange, and so on).
As an alternative, you can open it using this code:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"http://addressToYourics.ics"]];
But, unfortunately, you can't open bundle files with Safari, so I suggest you to use the EventKit library.
Take a look at another questions:
Is there a calendar control we can use for iPhone apps?
How to programmatically add calendar subscriptions on iOS?

Readonly items in ical iphone

I need to display some events on the iphone calendar from either a local app or possibly a remote server. I need the events shown in the iphone calendar to be readonly and am trying to figure out the best approach for this. Couple of questions to help me with the approach
-From ios iphone app can I write calendar events as readonly?
-If I need to go from the server to the phone can I give the phone a url to a icalendar that is readonly? which will disallow updates to the item on the phone?
-If I consume the events from the icalendar in to an iphone application can I tell what the origin of the item is? meaning can I tell the difference between things the user made locally, exchange, gmail etc.. and the icalendar readonly feed
Thanks
I'm afraid you cannot create a read-only calendar entry in a users calendar. After all, it's the users calendar, not your apps.
Nor can you create a separate calendar specific for your app that can read from a URL. You could provide the URL to the user and ask them to add it to iCal manually, but you cannot do it via the EventKit Framework.
You can't tell the origin of an event as EKEvent doesn't have any sort of public property that provides this information.
You would be able to infer which was the read-only calendar by iterating over the available calenders and looking at their titles. However, this would only work on the assumptions the user actually added your calendar manually, and they didn't change the title.
The best way to do something like this with all the features you want would be to add in-app calendar functionality to your app and make it completely independent of iCal and EventKit.
Here are a couple of projects which could help ...
Kal
Calendar UI

Does the iOS SDK give access to the Calendar picker used by iPhone's built-in Calenar app?

I've dug around a bit in the Eventkit/EventkitUI docs and couldn't find an answer. Does the iOS SDK provide a way to display the Calendar chooser view that the built-in Calendar app uses when you want to move an event to a different calendar? If not, what would be the best way to build that? How do I know which account each calendar is from? How do I display the little color dot? Are there any 3rd party libraries that provide something like this?
Thanks!
EDIT: Specifically I'm asking about this screen:
You don't get the UI for free, but you can get a list of the user's calendars with an EventStore's Calendar property.
You cannot distinguish between the calendar events. They all belong to one calendar by default. Event Kit only allows you to add, edit events on the default calendar. And you will need to use either third party calendar to replicate the UI or you will need to create your own. The question link given by Vagrant seems to be answering about the third party calendars.
https://github.com/klazuka/Kal is the most fav.

iphone sdk: pausing NSURLConnection?

In my app I give the user the ability to download files from a server. For that I use NSURLConnection. I would like to give the user the ability to pause and resume the download by tapping a button. I couldn't find any way to do this besides calling the cancel method and then creating a new NSURLConnection. So is there an elegant way to pause NSURLConnection?
Thanks
That's the only method I'm aware of. If your server supports the "Range:" header, you can then create a new connection and have it pick up where the other one left off.