[jira] [Commented] (CB-11975) Search on Contacts ‘id’ field with JavaScript number type crashes in iOS
[ https://issues.apache.org/jira/browse/CB-11975?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15730557#comment-15730557 ] ASF subversion and git services commented on CB-11975: -- Commit a19baba6fbba5ab6d18c27eee0db4c3a2ea94f17 in cordova-plugin-contacts's branch refs/heads/2.2.x from [~Nikita Matrosov] [ https://git-wip-us.apache.org/repos/asf?p=cordova-plugin-contacts.git;h=a19baba ] CB-11975 iOS: Allow to use numeric values in search filter This closes #139 > Search on Contacts ‘id’ field with JavaScript number type crashes in iOS > > > Key: CB-11975 > URL: https://issues.apache.org/jira/browse/CB-11975 > Project: Apache Cordova > Issue Type: Bug > Components: Plugin Contacts >Reporter: Andrew Forrest >Assignee: Nikita Matrosov >Priority: Critical > Labels: iOS, ios, reproduced, triaged > > I was trying to retrieve a specific contact by id in my Ionic/Cordova app, so > used the following code: > {code:javascript} > return Contacts.find( > ['id'], > {filter: contactId, multiple: true}) > {code} > However, this crashes the iOS app at runtime with: > {noformat} > 2016-10-07 17:33:12.331 MyApp[10998:1880417] -[__NSCFNumber > isEqualToString:]: unrecognized selector sent to instance 0xb053 > 2016-10-07 17:33:12.337 MyApp[10998:1880417] *** Terminating app due to > uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber > isEqualToString:]: unrecognized selector sent to instance 0xb053' > *** First throw call stack: > ( > 0 CoreFoundation 0x00010b0f334b > __exceptionPreprocess + 171 > 1 libobjc.A.dylib 0x00010ab2b21e > objc_exception_throw + 48 > 2 CoreFoundation 0x00010b162f34 > -[NSObject(NSObject) doesNotRecognizeSelector:] + 132 > 3 CoreFoundation 0x00010b078c15 > ___forwarding___ + 1013 > 4 CoreFoundation 0x00010b078798 > _CF_forwarding_prep_0 + 120 > 5 MyApp 0x0001097217b7 > __22-[CDVContacts search:]_block_invoke_2 + 983 > 6 MyApp 0x000109723760 > __42-[CDVAddressBookHelper createAddressBook:]_block_invoke_2 + 368 > 7 libdispatch.dylib 0x00010e4450cd > _dispatch_client_callout + 8 > 8 libdispatch.dylib 0x00010e4275e5 > _dispatch_barrier_sync_f_slow_invoke + 617 > 9 libdispatch.dylib 0x00010e4450cd > _dispatch_client_callout + 8 > 10 libdispatch.dylib 0x00010e4258d6 > _dispatch_main_queue_callback_4CF + 406 > 11 CoreFoundation 0x00010b0b74f9 > __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9 > 12 CoreFoundation 0x00010b07cf8d > __CFRunLoopRun + 2205 > 13 CoreFoundation 0x00010b07c494 > CFRunLoopRunSpecific + 420 > 14 GraphicsServices0x0001107aea6f > GSEventRunModal + 161 > 15 UIKit 0x00010be0df34 > UIApplicationMain + 159 > 16 MyApp 0x00010962e531 main + 65 > 17 libdyld.dylib 0x00010e49168d start + 1 > ) > libc++abi.dylib: terminating with uncaught exception of type NSException > (lldb) > {noformat} > Seems to only fail when {{contactId}} is a JavaScript number. Converting it > to a string before searching ({{contactId+""}}) works fine. > Fault originally occurred because Contact {{id}} field in iOS is an integer… > and it looks like I’m getting a JavaScript number value out of the Contacts > API. Was storing this integer in SQLite (which preserves the data type), > getting an integer back out, and passing it back into the {{Contacts.find()}} > API. > Suggest: > * Contacts {{id}} field is supposed to return a string, so it should return > a string on iOS > * {{Contacts.find()}} should coerce its arguments to correct types before > calling native code. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-11975) Search on Contacts ‘id’ field with JavaScript number type crashes in iOS
[ https://issues.apache.org/jira/browse/CB-11975?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15628048#comment-15628048 ] ASF GitHub Bot commented on CB-11975: - Github user asfgit closed the pull request at: https://github.com/apache/cordova-plugin-contacts/pull/139 > Search on Contacts ‘id’ field with JavaScript number type crashes in iOS > > > Key: CB-11975 > URL: https://issues.apache.org/jira/browse/CB-11975 > Project: Apache Cordova > Issue Type: Bug > Components: Plugin Contacts >Reporter: Andrew Forrest >Assignee: Nikita Matrosov >Priority: Critical > Labels: iOS, ios, reproduced, triaged > > I was trying to retrieve a specific contact by id in my Ionic/Cordova app, so > used the following code: > {code:javascript} > return Contacts.find( > ['id'], > {filter: contactId, multiple: true}) > {code} > However, this crashes the iOS app at runtime with: > {noformat} > 2016-10-07 17:33:12.331 MyApp[10998:1880417] -[__NSCFNumber > isEqualToString:]: unrecognized selector sent to instance 0xb053 > 2016-10-07 17:33:12.337 MyApp[10998:1880417] *** Terminating app due to > uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber > isEqualToString:]: unrecognized selector sent to instance 0xb053' > *** First throw call stack: > ( > 0 CoreFoundation 0x00010b0f334b > __exceptionPreprocess + 171 > 1 libobjc.A.dylib 0x00010ab2b21e > objc_exception_throw + 48 > 2 CoreFoundation 0x00010b162f34 > -[NSObject(NSObject) doesNotRecognizeSelector:] + 132 > 3 CoreFoundation 0x00010b078c15 > ___forwarding___ + 1013 > 4 CoreFoundation 0x00010b078798 > _CF_forwarding_prep_0 + 120 > 5 MyApp 0x0001097217b7 > __22-[CDVContacts search:]_block_invoke_2 + 983 > 6 MyApp 0x000109723760 > __42-[CDVAddressBookHelper createAddressBook:]_block_invoke_2 + 368 > 7 libdispatch.dylib 0x00010e4450cd > _dispatch_client_callout + 8 > 8 libdispatch.dylib 0x00010e4275e5 > _dispatch_barrier_sync_f_slow_invoke + 617 > 9 libdispatch.dylib 0x00010e4450cd > _dispatch_client_callout + 8 > 10 libdispatch.dylib 0x00010e4258d6 > _dispatch_main_queue_callback_4CF + 406 > 11 CoreFoundation 0x00010b0b74f9 > __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9 > 12 CoreFoundation 0x00010b07cf8d > __CFRunLoopRun + 2205 > 13 CoreFoundation 0x00010b07c494 > CFRunLoopRunSpecific + 420 > 14 GraphicsServices0x0001107aea6f > GSEventRunModal + 161 > 15 UIKit 0x00010be0df34 > UIApplicationMain + 159 > 16 MyApp 0x00010962e531 main + 65 > 17 libdyld.dylib 0x00010e49168d start + 1 > ) > libc++abi.dylib: terminating with uncaught exception of type NSException > (lldb) > {noformat} > Seems to only fail when {{contactId}} is a JavaScript number. Converting it > to a string before searching ({{contactId+""}}) works fine. > Fault originally occurred because Contact {{id}} field in iOS is an integer… > and it looks like I’m getting a JavaScript number value out of the Contacts > API. Was storing this integer in SQLite (which preserves the data type), > getting an integer back out, and passing it back into the {{Contacts.find()}} > API. > Suggest: > * Contacts {{id}} field is supposed to return a string, so it should return > a string on iOS > * {{Contacts.find()}} should coerce its arguments to correct types before > calling native code. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-11975) Search on Contacts ‘id’ field with JavaScript number type crashes in iOS
[ https://issues.apache.org/jira/browse/CB-11975?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15568711#comment-15568711 ] ASF GitHub Bot commented on CB-11975: - Github user cordova-qa commented on the issue: https://github.com/apache/cordova-plugin-contacts/pull/139 Cordova CI Build has completed successfully. **Commit** - [Link](https://github.com/apache/cordova-plugin-contacts/pull/139/commits/89038e72d7783b6b94315e5da472022362139953) **Dashboard** - [Link](http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-contacts-pr/47/) | Builder Name | Console Output | Test Report | Device Logs | | :---: | :---: | :---: | :---:| | [Windows 8.1 Store]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-contacts-pr/47//PLATFORM=windows-8.1-store/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-contacts-pr/47//PLATFORM=windows-8.1-store/console) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-contacts-pr/47//PLATFORM=windows-8.1-store/testReport/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-contacts-pr/47//PLATFORM=windows-8.1-store/artifact/) | | [Windows 10 Store]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-contacts-pr/47//PLATFORM=windows-10-store/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-contacts-pr/47//PLATFORM=windows-10-store/console) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-contacts-pr/47//PLATFORM=windows-10-store/testReport/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-contacts-pr/47//PLATFORM=windows-10-store/artifact/) | | [Windows 8.1 Phone]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-contacts-pr/47//PLATFORM=windows-8.1-phone/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-contacts-pr/47//PLATFORM=windows-8.1-phone/console) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-contacts-pr/47//PLATFORM=windows-8.1-phone/testReport/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-contacts-pr/47//PLATFORM=windows-8.1-phone/artifact/) | | [iOS]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-contacts-pr/47//PLATFORM=ios/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-contacts-pr/47//PLATFORM=ios/console) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-contacts-pr/47//PLATFORM=ios/testReport/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-contacts-pr/47//PLATFORM=ios/artifact/) | | [Android]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-contacts-pr/47//PLATFORM=android/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-contacts-pr/47//PLATFORM=android/console) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-contacts-pr/47//PLATFORM=android/testReport/) | [Link]( http://cordova-ci.cloudapp.net:8080/job/cordova-plugin-contacts-pr/47//PLATFORM=android/artifact/) | > Search on Contacts ‘id’ field with JavaScript number type crashes in iOS > > > Key: CB-11975 > URL: https://issues.apache.org/jira/browse/CB-11975 > Project: Apache Cordova > Issue Type: Bug > Components: Plugin Contacts >Reporter: Andrew Forrest >Assignee: Nikita Matrosov >Priority: Critical > Labels: iOS, ios, reproduced, triaged > > I was trying to retrieve a specific contact by id in my Ionic/Cordova app, so > used the following code: > {code:javascript} > return Contacts.find( > ['id'], > {filter: contactId, multiple: true}) > {code} > However, this crashes the iOS app at runtime with: > {noformat} > 2016-10-07 17:33:12.331 MyApp[10998:1880417] -[__NSCFNumber > isEqualToString:]: unrecognized selector sent to instance 0xb053 > 2016-10-07 17:33:12.337 MyApp[10998:1880417] *** Terminating app due to > uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber > isEqualToString:]: unrecognized selector sent to instance 0xb053' > *** First throw call stack: > ( > 0 CoreFoundation 0x00010b0f334b > __exceptionPreprocess + 171 > 1 libobjc.A.dylib 0x00010ab2b21e > objc_exception_throw + 48 > 2 CoreFoundation 0x00010b162f34 > -[NSObject(NSObject) doesNotRecognizeSelector:] + 132 > 3 CoreFoundation 0x00010b078c15 > ___forwarding___ + 1013 > 4 CoreFoundation 0x00010b078798 > _CF_forwarding_prep_0 + 120 > 5 MyApp 0x0001097217b7 > __22-[CDVContacts search:]_block_invoke_2 + 983 > 6 MyApp
[jira] [Commented] (CB-11975) Search on Contacts ‘id’ field with JavaScript number type crashes in iOS
[ https://issues.apache.org/jira/browse/CB-11975?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15568462#comment-15568462 ] ASF GitHub Bot commented on CB-11975: - GitHub user matrosov-nikita opened a pull request: https://github.com/apache/cordova-plugin-contacts/pull/139 CB-11975 iOS: Search on contacts' id with number type ### Platforms affected iOS ### What does this PR do? There was crash when user passed id of numeric type. This PR makes possible to search for contact by id either string or numeric type as well as on Android platform. ### What testing has been done on this change? Auto test ### Checklist - [x] [Reported an issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database - [x] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB- is the JIRA ID & "android" is the platform affected. - [x] Added automated test coverage as appropriate for this change. You can merge this pull request into a Git repository by running: $ git pull https://github.com/matrosov-nikita/cordova-plugin-contacts CB-11975 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cordova-plugin-contacts/pull/139.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #139 commit 89038e72d7783b6b94315e5da472022362139953 Author: Nikita MatrosovDate: 2016-10-10T09:02:17Z CB-11975 iOS: Search on contacts' id with number type There was crash when user passed id of numeric type > Search on Contacts ‘id’ field with JavaScript number type crashes in iOS > > > Key: CB-11975 > URL: https://issues.apache.org/jira/browse/CB-11975 > Project: Apache Cordova > Issue Type: Bug > Components: Plugin Contacts >Reporter: Andrew Forrest >Assignee: Nikita Matrosov >Priority: Critical > Labels: iOS, ios, reproduced, triaged > > I was trying to retrieve a specific contact by id in my Ionic/Cordova app, so > used the following code: > {code:javascript} > return Contacts.find( > ['id'], > {filter: contactId, multiple: true}) > {code} > However, this crashes the iOS app at runtime with: > {noformat} > 2016-10-07 17:33:12.331 MyApp[10998:1880417] -[__NSCFNumber > isEqualToString:]: unrecognized selector sent to instance 0xb053 > 2016-10-07 17:33:12.337 MyApp[10998:1880417] *** Terminating app due to > uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber > isEqualToString:]: unrecognized selector sent to instance 0xb053' > *** First throw call stack: > ( > 0 CoreFoundation 0x00010b0f334b > __exceptionPreprocess + 171 > 1 libobjc.A.dylib 0x00010ab2b21e > objc_exception_throw + 48 > 2 CoreFoundation 0x00010b162f34 > -[NSObject(NSObject) doesNotRecognizeSelector:] + 132 > 3 CoreFoundation 0x00010b078c15 > ___forwarding___ + 1013 > 4 CoreFoundation 0x00010b078798 > _CF_forwarding_prep_0 + 120 > 5 MyApp 0x0001097217b7 > __22-[CDVContacts search:]_block_invoke_2 + 983 > 6 MyApp 0x000109723760 > __42-[CDVAddressBookHelper createAddressBook:]_block_invoke_2 + 368 > 7 libdispatch.dylib 0x00010e4450cd > _dispatch_client_callout + 8 > 8 libdispatch.dylib 0x00010e4275e5 > _dispatch_barrier_sync_f_slow_invoke + 617 > 9 libdispatch.dylib 0x00010e4450cd > _dispatch_client_callout + 8 > 10 libdispatch.dylib 0x00010e4258d6 > _dispatch_main_queue_callback_4CF + 406 > 11 CoreFoundation 0x00010b0b74f9 > __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9 > 12 CoreFoundation 0x00010b07cf8d > __CFRunLoopRun + 2205 > 13 CoreFoundation 0x00010b07c494 > CFRunLoopRunSpecific + 420 > 14 GraphicsServices0x0001107aea6f > GSEventRunModal + 161 > 15 UIKit 0x00010be0df34 > UIApplicationMain + 159 > 16 MyApp 0x00010962e531 main + 65 > 17 libdyld.dylib 0x00010e49168d start + 1 > ) > libc++abi.dylib: terminating with uncaught exception of type NSException > (lldb) > {noformat} > Seems to only fail when