Titanium JIRA Archive
Appcelerator Community (AC)

[AC-6714] fetchExistence causes a crash on iOS but works fine on Android

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionInvalid
Resolution Date2021-07-26T19:43:27.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelscrash, ios, ti.identity
ReporterFerdinando Traversa
AssigneeAbir Mukherjee
Created2021-07-26T07:41:24.000+0000
Updated2021-07-26T19:43:27.000+0000

Description

Hi, using the keychainItem.fetchExistence from ti.identitymethod causes a crash on iOS but works absolutely fine on Android. This happens only if the app was uninstalled and reinstalled and the token consequently continues to exist (that happens also only on iOS, because on Android the token is deleted with the app). Thanks in advance for all the help. You can find the app source code here: https://github.com/ferdi2005/monumenti/blob/3eedf2b1b26a4f7e819acf65796832b060005b1c/app/controllers/upload/config.js *Code:*
            var keychainItem = Identity.createKeychainItem({ identifier: "token" });

                keychainItem.fetchExistence({
                    result: function(e) {
                        if (e.exists) {
                            keychainItem.reset();
                        }  
                    }
                });
*Stacktrace*:
[DEBUG] -[__NSCFString count]: unrecognized selector sent to instance 0x7fe66189b400
[DEBUG] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString count]: unrecognized selector sent to instance 0x7fe66189b400'
[DEBUG] *** First throw call stack:
[DEBUG] ( 
[DEBUG]         0   CoreFoundation                      0x0000000113b7bfba __exceptionPreprocess + 242
[DEBUG]         1   libobjc.A.dylib                     0x00000001107f8ff5 objc_exception_throw + 48
[DEBUG]         2   CoreFoundation                      0x0000000113b8ad2f +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0
[DEBUG]         3   CoreFoundation                      0x0000000113b804cf ___forwarding___ + 1455
[DEBUG]         4   CoreFoundation                      0x0000000113b827a8 _CF_forwarding_prep_0 + 120
[DEBUG]         5   TitaniumKit                         0x00000001136b93f5 -[TiScriptError formattedNativeStack] + 133
[DEBUG]         6   TitaniumKit                         0x00000001136b92fb -[TiScriptError description] + 1127
[DEBUG]         7   Foundation                          0x00000001113aad9b _NSDescriptionWithLocaleFunc + 82
[DEBUG]         8   CoreFoundation                      0x0000000113b14af3 __CFStringAppendFormatCore + 12167
[DEBUG]         9   CoreFoundation                      0x0000000113b16589 _CFStringCreateWithFormatAndArgumentsReturningMetadata + 145
[DEBUG]         10  CoreFoundation                      0x0000000113b164f2 _CFStringCreateWithFormatAndArgumentsAux2 + 20
[DEBUG]         11  TitaniumKit                         0x000000011367b6dd TiLogMessage + 175
[DEBUG]         12  TitaniumKit                         0x00000001136b88b0 -[TiExceptionHandler reportScriptError:] + 74
[DEBUG]         13  TitaniumKit                         0x00000001136a579e TiBindingEventProcess + 731
[DEBUG]         14  TitaniumKit                         0x00000001136c6c23 -[KrollContext invoke:] + 109
[DEBUG]         15  TitaniumKit                         0x00000001136c6c96 -[KrollContext enqueue:] + 93
[DEBUG]         16  TitaniumKit                         0x00000001136ce06f TiBindingRunLoopEnqueue + 77
[DEBUG]         17  TitaniumKit                         0x00000001136cc93f -[TiProxy fireEvent:withObject:withSource:propagate:reportSuccess:errorCode:message:] + 170
[DEBUG]         18  TitaniumKit                         0x00000001136ad415 -[TiViewProxy fireEvent:withObject:withSource:propagate:reportSuccess:errorCode:message:] + 182
[DEBUG]         19  TitaniumKit                         0x000000011367f0f5 -[TiWindowProxy windowDidOpen] + 107
[DEBUG]         20  WLM Italia                          0x000000010cd83400 -[TiUITabProxy handleWillShowViewController:animated:] + 512
[DEBUG]         21  WLM Italia                          0x000000010cd830d9 -[TiUITabProxy navigationController:willShowViewController:animated:] + 457
[DEBUG]         22  UIKitCore                           0x00000001224c0031 -[UINavigationController _startCustomTransition:] + 1596
[DEBUG]         23  UIKitCore                           0x00000001224d630d -[UINavigationController _startDeferredTransitionIfNeeded:] + 705
[DEBUG]         24  UIKitCore                           0x00000001224d7734 -[UINavigationController __viewWillLayoutSubviews] + 150
[DEBUG]         25  UIKitCore                           0x00000001224b804c -[UILayoutContainerView layoutSubviews] + 217
[DEBUG]         26  UIKitCore                           0x0000000123233c90 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2946
[DEBUG]         27  QuartzCore                          0x00000001129745b8 -[CALayer layoutSublayers] + 258
[DEBUG]         28  QuartzCore                          0x000000011297ae3f _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 611
[DEBUG]         29  QuartzCore                          0x0000000112986c53 _ZN2CA5Layer28layout_and_display_if_neededEPNS_11TransactionE + 65
[DEBUG]         30  QuartzCore                          0x00000001128c0f26 _ZN2CA7Context18commit_transactionEPNS_11TransactionEdPd + 656
[DEBUG]         31  QuartzCore                          0x00000001128f83b9 _ZN2CA11Transaction6commitEv + 713
[DEBUG]         32  QuartzCore                          0x00000001128f951f _ZN2CA11Transaction17observer_callbackEP19__CFRunLoopObservermPv + 79
[DEBUG]         33  CoreFoundation                      0x0000000113ae8d31 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
[DEBUG]         34  CoreFoundation                      0x0000000113ae3542 __CFRunLoopDoObservers + 541
[DEBUG]         35  CoreFoundation                      0x0000000113ae3af5 __CFRunLoopRun + 1129
[DEBUG]         36  CoreFoundation                      0x0000000113ae31a7 CFRunLoopRunSpecific + 567
[DEBUG]         37  GraphicsServices                    0x00000001270e5d85 GSEventRunModal + 139
[DEBUG]         38  UIKitCore                           0x0000000122cdc4df -[UIApplication _run] + 912
[DEBUG]         39  UIKitCore                           0x0000000122ce139c UIApplicationMain + 101
[DEBUG]         40  WLM Italia                          0x000000010cd53392 main + 1170
[DEBUG]         41  libdyld.dylib                       0x000000011792abbd start + 1
[DEBUG]         42  ???                                 0x0000000000000001 0x0 + 1
[DEBUG] ) 
[DEBUG] libc++abi: terminating with uncaught exception of type NSException

Attachments

FileDateSize
attachment.txt2021-07-26T07:40:58.000+000093475

Comments

  1. Jórdan Luiz Bisato 2021-07-26

    I think you can't pass a JSON to function. Try this way:
       var keychainItem = Identity.createKeychainItem({ identifier: "token" });
        
                       keychainItem.fetchExistence(function(e) {
       				if (e.exists) {
                                          // do what you want
                                       }
       	        });
       
  2. Ferdinando Traversa 2021-07-26

    Ouch! Thanks Jordan, again my fault. I thought that there was a createHTTPClient-like behaviour.

JSON Source