rdelrosario / xamarin-plugins

Cross platform Xamarin & Windows plugins for PCLs
MIT License
179 stars 161 forks source link

Exception after upgrade from 1.0.10 to 1.1.0 or 1.1.1 #25

Closed Lina84 closed 8 years ago

Lina84 commented 8 years ago

After upgrade I get the error when push notification arrives: 12-22 23:34:31.285 E/mono ( 1453): Newtonsoft.Json.JsonReaderException: Error reading JObject from JsonReader. Current JsonReader item is not an object: Integer. Path '', line 1, position 1. 12-22 23:34:31.285 E/mono ( 1453): at (wrapper dynamic-method) System.Object:38ab4821-8395-4444-b869-68cb019a5379 (intptr,intptr,intptr,intptr) 12-22 23:34:31.285 E/mono ( 1453): at (wrapper native-to-managed) System.Object:38ab4821-8395-4444-b869-68cb019a5379 (intptr,intptr,intptr,intptr) 12-22 23:34:31.285 E/mono-rt ( 1453): [ERROR] FATAL UNHANDLED EXCEPTION: Newtonsoft.Json.JsonReaderException: Error reading JObject from JsonReader. Current JsonReader item is not an object: Integer. Path '', line 1, position 1. 12-22 23:34:31.285 E/mono-rt ( 1453): at (wrapper dynamic-method) System.Object:38ab4821-8395-4444-b869-68cb019a5379 (intptr,intptr,intptr,intptr) 12-22 23:34:31.285 E/mono-rt ( 1453): at (wrapper native-to-managed) System.Object:38ab4821-8395-4444-b869-68cb019a5379 (intptr,intptr,intptr,intptr)

I've defined my OnMessage as follows: public void OnMessage(JObject values, DeviceType deviceType) { Debug.WriteLine("Message Arrived"); try { } catch (Exception ex) { } }

In 1.0.10 it was: public void OnMessage(IDictionary<string, object> Parameters, DeviceType deviceType) { Debug.WriteLine("Message Arrived"); try { LastScreen = Parameters["screen"].ToString(); } catch (Exception ex) { } }

What do I do wrong? Thanks in advance for any help.

rdelrosario commented 8 years ago

Hi

There was a bug related to integer parsing. Please try the new version just released: v.1.1.2

https://www.nuget.org/packages/Xam.Plugin.PushNotification

Should fix your issue. Let me know if works.

On Tue, Dec 22, 2015 at 4:47 PM, Lina84 notifications@github.com wrote:

After upgrade I get the error when push notification arrives: 12-22 23:34:31285 E/mono ( 1453): NewtonsoftJsonJsonReaderException: Error reading JObject from JsonReader Current JsonReader item is not an object: Integer Path '', line 1, position 1 12-22 23:34:31285 E/mono ( 1453): at (wrapper dynamic-method) SystemObject:38ab4821-8395-4444-b869-68cb019a5379 (intptr,intptr,intptr,intptr) 12-22 23:34:31285 E/mono ( 1453): at (wrapper native-to-managed) SystemObject:38ab4821-8395-4444-b869-68cb019a5379 (intptr,intptr,intptr,intptr) 12-22 23:34:31285 E/mono-rt ( 1453): [ERROR] FATAL UNHANDLED EXCEPTION: NewtonsoftJsonJsonReaderException: Error reading JObject from JsonReader Current JsonReader item is not an object: Integer Path '', line 1, position 1 12-22 23:34:31285 E/mono-rt ( 1453): at (wrapper dynamic-method) SystemObject:38ab4821-8395-4444-b869-68cb019a5379 (intptr,intptr,intptr,intptr) 12-22 23:34:31285 E/mono-rt ( 1453): at (wrapper native-to-managed) SystemObject:38ab4821-8395-4444-b869-68cb019a5379 (intptr,intptr,intptr,intptr)

I've defined my OnMessage as follows: public void OnMessage(JObject values, DeviceType deviceType) { DebugWriteLine("Message Arrived"); try { } catch (Exception ex) { } }

In 1010 it was: public void OnMessage(IDictionary Parameters, DeviceType deviceType) { DebugWriteLine("Message Arrived"); try { LastScreen = Parameters["screen"]ToString(); } catch (Exception ex) { } }

What do I do wrong? Thanks in advance for any help

— Reply to this email directly or view it on GitHub https://github.com/rdelrosario/xamarin-plugins/issues/25.

Lina84 commented 8 years ago

Now it works. Thank you!