TheCocoaProject / cordova-plugin-nativestorage

Cordova plugin: Native storage of variables in Android, iOS and Windows
http://thecocoaproject.github.io/
Apache License 2.0
292 stars 106 forks source link

Implicit conversion loses integer precision warnings #24

Closed BenjaminConant closed 8 years ago

BenjaminConant commented 8 years ago

Getting two warnings from NativeStorage.m on build... build succeeds but would like to know whats going on ..

screen shot 2016-06-13 at 3 05 16 pm screen shot 2016-06-13 at 3 05 29 pm
alokrajiv commented 8 years ago

@BenjaminConant Hi, I'm assuming the issue shot because of 64-bit unsigned long being 64bit but the int is 32-bit. so there is precision loss, I'm assuming for very large number with representations above said limits. But, I'll let @GillesC comment as well because I'm not very familiar with the objective-c implementation at that particular point.

GillesC commented 8 years ago

@BenjaminConant alokrajiv is correct. In Android the number is also stored as an integer and not as a long (which is a NSInteger in iOS). Because of this reason I've opted to store it as an int. So the same functionality is provided by Android and iOS. But now I've changed the code so an NSInteger is stored, which resolves your 'problem', i.e. the generated warning.

This change is only made in the experimental repo through Github. To install this version please uninstall the current plugin: cordova plugin remove cordova-plugin-nativestorage And add the plugin via Github: cordova plugin add https://github.com/TheCocoaProject/cordova-plugin-nativestorage

FYI the warning is generated in a method (putInt) which is only invoked when using the API prior to version 2.