Loading events from WebMethod

Thread is closed for posting
3 posts, 0 answers
  1. Bob
    Bob avatar
    4 posts
    Member since:
    Sep 2012

    Posted 30 Nov 2016 Link to this post

     I have just downloaded the iOS suite and I'd like to populate the calendar from a WebMethod (JSON)

    What I'd like to do is to have the WebMethod called for the current month in the createEvents function, but when the user scrolls to a different month, the Method is called again with that months range. Is there a way to get the currently displayed months first and last days in the createEvents function?


  2. Bob
    Bob avatar
    4 posts
    Member since:
    Sep 2012

    Posted 02 Dec 2016 Link to this post

    I've managed to get this in now. Although the dots for each day with something on do not appear now. 

    my current code is:

        func createEvents() {

            if self.events.count > 0 {

            let currentDate: Date = self.calendarView.displayedDate
            let startDate: Date = Date().startOfMonth(myDate: currentDate)!
            let endDate: Date = Date().endOfMonth(myDate: currentDate)!

            let paramString : String = String(format: "Token=%@&StartDate=%@&EndDate=%@", keychain.get("sessionToken")!, DateFormatting().getStandardDate(startDate, dateTimeReq: "DateDashed"), DateFormatting().getStandardDate(endDate, dateTimeReq: "DateDashed"))

            DataFunctions().getRequest(methodName: "DiaryWebMethod", parameters: paramString) { (result) -> () in
                for item in result {
                    if item["Error"] != nil {
                        if (item["Error"] as? String == "501") {
                            SCLAlertView().showError("Unable to fetch appointments", subTitle: "Error 501 was raised. ")
                        } else {
                            SCLAlertView().showError("Unable to fetch appointments", subTitle: item["Error"] as! String)
                    } else {
                        let e = TKCalendarEvent()
                        e.title = item["Title"] as? String
                        e.startDate = Date(jsonDate: item["StartDate"] as! String)! //item["StartDateTime"] as! Date
                        e.endDate = Date(jsonDate: item["EndDate"] as! String)! //item["StopDateTime"] as! Date
                        e.content = item["Summary"] as? String
                        e.isAllDay = false
                        e.eventColor = UIColor(r:40, g:86, b:131)


    Any ideas why this is the case?

  3. Adrian
    Adrian avatar
    174 posts

    Posted 02 Dec 2016 Link to this post

    Hello, Bob,

    Could you send me a sample project with the dots issue so I could investigate it further? Thank you in advance for the cooperation.

    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top