EddyVerbruggen / Calendar-PhoneGap-Plugin

:date: Cordova plugin to Create, Change, Delete and Find Events in the native Calendar
773 stars 402 forks source link

Calendar Privacy Setting in iOS #85

Open VigneswaranMarimuthu opened 10 years ago

VigneswaranMarimuthu commented 10 years ago

Hi Eddy,

If i disable the calendar privacy for my app and try to save an event, the app crashes. Just wanted to know, is there any way to handle this ? Or is it possible from the plugin side ?

Regards,

Vigneswaran M

EddyVerbruggen commented 10 years ago

Hi,

When using createEvent with blocked calendar access (privacy settings of iOS), the errorcallback of that function should be called. If you alert the passed message, you should see this:

ios-simulatorschermafbeelding 26 jul 2014 11 51 43

VigneswaranMarimuthu commented 10 years ago

Hi Eddy,

Thanks for your reply. Will it be the case when i use 'findEvent' ? Because i want to check if event exists before adding the event to calendar. In this case, the app crashes :(

EddyVerbruggen commented 10 years ago

That is odd. I get the same popup with findEvent. Could you share your XCode project with me? Also, which exact device is crashing? eddyverbruggen at gmail dot com.

VigneswaranMarimuthu commented 10 years ago

Eddy,

This is the JS code we are using. I have put some alert so that i can check where exactly is failing.

findEvent: function (subject, location, notes, startDate, endDate,
        successCB, failureCB, scope) {
        var plugins = window.plugins;
        if (plugins && plugins.calendar) {
            plugins.calendar.findEvent(subject, location, notes, startDate,
                endDate, function () {
                    alert('Find Event Success : ' + JSON.stringify(arguments));
                    successCB.apply(scope || window, arguments);
                }, function () {
                    alert('Find Event Failure : ' + JSON.stringify(arguments));
                    failureCB.apply(scope || window, arguments);
                });
        } else {
            console.log(
                'Calendar plugin not present. Calling failure callback');
            failureCB.apply(scope || window, arguments);
        }
    }

When i turn on the Privacy setting, i was able to see these alerts but when i turned privacy off, the app crashes. I am using iPhone 4S to test (running on iOS 7.1.2).

EddyVerbruggen commented 10 years ago

Hi,

Can you doublecheck the passed in failureCB is actually a function?

I don't have a 4S anymore.. I'd love to try your project on my 5 with the same iOS version, but then I really need your project.

Also, can you test on any other device or simulator and see different behaviour?

VigneswaranMarimuthu commented 10 years ago

Hi Eddy,

failureCB is actually a function. I verified it.

Our project setup is really of huge size (100 MB +) to ZIP and transfer. What i will do is, create a sample project and will check that one in my 4S and will send you the project.