EddyVerbruggen / Calendar-PhoneGap-Plugin

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

ios 9 crash when create interacty calendar, logs down #298

Open jomarocas opened 8 years ago

jomarocas commented 8 years ago

https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin/issues/237 this issue is related that i have, but is closed, and really dont solutions in the before issue.

this code working good in android 5 or 6 all version, crash in ios 9 with real device and ios emulator with iphone 6 and ios 9.3, thanks if any help me

my code

  var titlecustom = title;
  var loccustom = 'Aquí';
  var notescustom = description;
  var gethourbegincustom = hour1;
  var gethourendcustom = hour2;
  var startdatecustomize = date1;
  var endDatecustomize = date2;
  var datebeginevent = moment().format(startdatecustomize + ' ' + gethourbegincustom);
  var dateendevent = moment().format(endDatecustomize + ' ' + gethourendcustom);
  var startDatecustom = new Date(datebeginevent);
  var endDatecustom = new Date(dateendevent);
window.plugins.calendar.createEventInteractively(titlecustom, loccustom, notescustom, startDatecustom, endDatecustom, onSuccess, onError)
window.plugins.calendar.createEvent(titlecustom, loccustom, notescustom, startDatecustom, endDatecustom, onSuccess, onError)

i use moment for detect local time for each user create event i use createEvent and createEventInteractively, but without success

[3062:104178] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull doubleValue]: unrecognized selector sent to instance 0x108c5ed80'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000108a36d85 __exceptionPreprocess + 165
    1   libobjc.A.dylib                     0x000000010c43ddeb objc_exception_throw + 48
    2   CoreFoundation                      0x0000000108a3fd3d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
    3   CoreFoundation                      0x0000000108985cfa ___forwarding___ + 970
    4   CoreFoundation                      0x00000001089858a8 _CF_forwarding_prep_0 + 120
    5   OncologiÃÅa Clinica del country     0x00000001087846c1 __35-[Calendar createEventWithOptions:]_block_invoke + 337
    6   libdispatch.dylib                   0x000000010cd04d9d _dispatch_call_block_and_release + 12
    7   libdispatch.dylib                   0x000000010cd253eb _dispatch_client_callout + 8
    8   libdispatch.dylib                   0x000000010cd0db2f _dispatch_root_queue_drain + 1829
    9   libdispatch.dylib                   0x000000010cd0d405 _dispatch_worker_thread3 + 111
    10  libsystem_pthread.dylib             0x000000010d0624de _pthread_wqthread + 1129
    11  libsystem_pthread.dylib             0x000000010d060341 start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

this is the log http://pastebin.com/iv97fmdt if any have the solution please post here

SaravanakumarVijay commented 8 years ago

helo bro,if u run in android successfully pls help me with my issues.i m struggled with one week.pls help me.i need to display calendar in my app.but it not showed.pls help me

EddyVerbruggen commented 8 years ago

What does moment.format() give you, a String or a Date?

jomarocas commented 8 years ago

@EddyVerbruggen i send this value first value startdatecustomize = 2016-06-08 gethourbegincustom = 14:27 datebeginevent = 2016-06-08 14:27 startDatecustom = 2016-06-08T19:27:00.000Z in android the calendar create is success with this date

EddyVerbruggen commented 8 years ago

Just for science, can you pass in a new Date() instead?

jomarocas commented 8 years ago
var datebeginevent = moment().format(startdatecustomize + ' ' + gethourbegincustom);//result 2016-06-08 14:27
var startDatecustom = new Date(datebeginevent); result 2016-06-08T19:27:00.000Z

sorry for no explain good, this is the values of each variables

pablomaurer commented 8 years ago

This Plugin requires a normal js Date Object. If you use momentjs, then convert your momentjs Date Object back to a normal js Date Object with this function moment().toDate();

jomarocas commented 8 years ago

@mnewmedia but the result is a normal js date object the result is this "result 2016-06-08T19:27:00.000Z" is a js date object, that i send to calendar, always send startdatecustom. in ios 9 crash, in android working very good

pablomaurer commented 8 years ago

but the .format returns ever a string, maybe the string looks the same like when you log the normal Date Object, but it's not the same. What do you have against toDate()?