Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parentChild sync targets not working when defined in usersyncs.json file #2359

Closed
grevolution opened this issue Jan 12, 2018 · 3 comments
Closed

Comments

@grevolution
Copy link
Contributor

grevolution commented Jan 12, 2018

Please fill out the following details:

If you define parentChild target for either syncUp or syncDown in your <user/global>syncs.json file. They are not read by the SDK and the application crashes because the SDK tried to add a nil target object into a dictionary.

Following is my sync

              {
                  "syncName": "syncDownInstallersWithContacts",
                  "syncType": "syncDown",
                  "soupName": "contacts",
                  "target": {
                      "type": "parentChildren",
                      "parent": {
                          "sobjectType": "Contact",
                          "soupName": "contacts",
              "idFieldName" : "Id","modificationDateFieldName" : "LastModifiedDate"
                      },
                      "parentFieldlist": ["Id", "Name"],
              "parentSoqlFilter" : "Id IN (select Installer__c from Installer__c)",
                      "children": {
                          "sobjectType": "Installer__c",
              "sobjectTypePlural": "Installers__r",
                          "soupName": "installers",
                          "parentIdFieldName": "Installer__c",
              "idFieldName" : "Id","modificationDateFieldName" : "LastModifiedDate"
                      },
                      "childrenFieldlist": ["Id", "Dealer__c", "Name", "Installer__c"],
                      "relationshipType": "LOOKUP"
                  },
                  "options": {
                    "mergeMode": "OVERWRITE"
                  }
              }
  1. Version of Mobile SDK Used: 6.0.0
  2. Issue found in Native App or Hybrid App: Native iOS
  3. OS Version: All versions
  4. Device: All devices
  5. Steps to reproduce:
    • add a parentChild type target in your syncDown sync in usersyncs.json file.
    • Initiate the SDK and after authentication, call SmartSyncSDKManager.shared().setupUserSyncsFromDefaultConfig()
    • App Crashes
  6. Actual behavior:
    • App Crashes
  7. Expected Behavior:
    • App should not crash, SDK should read a parentChild target sync from JSON file and download the data.
  8. Error Log:
2018-01-12 16:09:54.022622+1100 App[27303:614278] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[1]'
*** First throw call stack:
(
	0   CoreFoundation                      0x0000000111f2412b __exceptionPreprocess + 171
	1   libobjc.A.dylib                     0x00000001115b8f41 objc_exception_throw + 48
	2   CoreFoundation                      0x0000000111f640cc _CFThrowFormattedException + 194
	3   CoreFoundation                      0x0000000111e38951 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 321
	4   CoreFoundation                      0x0000000111e387db +[NSDictionary dictionaryWithObjects:forKeys:count:] + 59
	5   SmartSync                           0x0000000110e2697a +[SFSyncState newSyncDownWithOptions:target:soupName:name:store:] + 3306
	6   SmartSync                           0x0000000110df932c -[SFSmartSyncSyncManager createSyncDown:options:soupName:syncName:] + 1116
	7   SmartSync                           0x0000000110da87d7 -[SFSDKSyncsConfig createSyncs:] + 4071
	8   SmartSync                           0x0000000110e441bf -[SmartSyncSDKManager setupSyncsFromConfig:store:] + 815
	9   SmartSync                           0x0000000110e43df5 -[SmartSyncSDKManager setupUserSyncsFromDefaultConfig] + 933
	10  App                         0x000000010e43c29e _T011App18SObjectDataManagerCACyxGAA0bC12SpecProtocol_p04dataE0_tcfc + 4462
	11  App                         0x000000010e43b0ee _T011App18SObjectDataManagerCACyxGAA0bC12SpecProtocol_p04dataE0_tcfC + 174
	12  App                         0x000000010e3fc10d _T011App18RootViewControllerCACSSSg7nibName_So6BundleCSg6bundletcfc + 1021
	13  App                         0x000000010e3fbd00 _T011App18RootViewControllerCACSSSg7nibName_So6BundleCSg6bundletcfC + 80
	14  App                         0x000000010e3df7c7 _T011App11AppDelegateC23setupRootViewControlleryyF + 1095
	15  App                         0x000000010e3dadf3 _T011App11AppDelegateCACycfcySC17SFSDKLaunchActionVcfU_ + 3907
	16  App                         0x000000010e3daeac _T011App11AppDelegateCACycfcySC17SFSDKLaunchActionVcfU_TA + 12
	17  App                         0x000000010e3daf3e _T0SC17SFSDKLaunchActionVIxy_ABIyBy_TR + 142
	18  SalesforceSDKCore                   0x0000000110700cdf -[SalesforceSDKManager sendPostLaunch] + 511
	19  SalesforceSDKCore                   0x000000011070a752 -[SalesforceSDKManager authValidatedToPostAuth:] + 258
	20  SalesforceSDKCore                   0x000000011070a641 -[SalesforceSDKManager authBypassAtLaunch] + 1857
	21  SalesforceSDKCore                   0x0000000110708758 -[SalesforceSDKManager authValidationAtLaunch] + 1096
	22  SalesforceSDKCore                   0x00000001107082fb -[SalesforceSDKManager passcodeValidatedToAuthValidation] + 331
	23  SalesforceSDKCore                   0x0000000110707f02 __50-[SalesforceSDKManager passcodeValidationAtLaunch]_block_invoke + 386
	24  SalesforceSDKCore                   0x0000000110956f08 +[SFSecurityLockout unlockSuccessPostProcessing:] + 1000
	25  SalesforceSDKCore                   0x000000011095278b +[SFSecurityLockout lock] + 1147
	26  SalesforceSDKCore                   0x0000000110707cb3 -[SalesforceSDKManager passcodeValidationAtLaunch] + 1603
	27  SalesforceSDKCore                   0x00000001106f70f2 -[SalesforceSDKManager launch] + 2850
	28  App                         0x000000010e3dd0ff _T011App11AppDelegateC11applicationSbSo13UIApplicationC_s10DictionaryVySC0E16LaunchOptionsKeyVypGSg022didFinishLaunchingWithH0tF + 2111
	29  App                         0x000000010e3dd459 _T011App11AppDelegateC11applicationSbSo13UIApplicationC_s10DictionaryVySC0E16LaunchOptionsKeyVypGSg022didFinishLaunchingWithH0tFTo + 281
	30  UIKit                               0x000000011434bbca -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 299
	31  UIKit                               0x000000011434d648 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4113
	32  UIKit                               0x0000000114352aeb -[UIApplication _runWithMainScene:transitionContext:completion:] + 1720
	33  UIKit                               0x000000011471c6f8 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 924
	34  UIKit                               0x0000000114af24c8 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
	35  UIKit                               0x000000011471c2f1 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 249
	36  UIKit                               0x000000011471cb6b -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 696
	37  UIKit                               0x000000011509aa69 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 262
	38  UIKit                               0x000000011509a922 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 444
	39  UIKit                               0x0000000114d779c8 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 221
	40  UIKit                               0x0000000114f76b06 _performActionsWithDelayForTransitionContext + 100
	41  UIKit                               0x0000000114d7788b -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 231
	42  UIKit                               0x0000000114af1b25 -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
	43  UIKit                               0x000000011435136a -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 523
	44  UIKit                               0x000000011492c605 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 369
	45  FrontBoardServices                  0x0000000118cc8cc0 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 338
	46  FrontBoardServices                  0x0000000118cd17b5 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 235
	47  libdispatch.dylib                   0x0000000116e9533d _dispatch_client_callout + 8
	48  libdispatch.dylib                   0x0000000116e9a9f3 _dispatch_block_invoke_direct + 592
	49  FrontBoardServices                  0x0000000118cfd498 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
	50  FrontBoardServices                  0x0000000118cfd14e -[FBSSerialQueue _performNext] + 464
	51  FrontBoardServices                  0x0000000118cfd6bd -[FBSSerialQueue _performNextFromRunLoopSource] + 45
	52  CoreFoundation                      0x0000000111ec7101 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
	53  CoreFoundation                      0x0000000111f66f71 __CFRunLoopDoSource0 + 81
	54  CoreFoundation                      0x0000000111eaba19 __CFRunLoopDoSources0 + 185
	55  CoreFoundation                      0x0000000111eaafff __CFRunLoopRun + 1279
	56  CoreFoundation                      0x0000000111eaa889 CFRunLoopRunSpecific + 409
	57  GraphicsServices                    0x00000001195919c6 GSEventRunModal + 62
	58  UIKit                               0x00000001143545d6 UIApplicationMain + 159
	59  App                         0x000000010e42f36a main + 922
	60  libdyld.dylib                       0x0000000114215d81 start + 1
	61  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
@grevolution
Copy link
Contributor Author

I have fixed the issue and opened a PR #2358

@wmathurin
Copy link
Contributor

Thanks @grevolution for your fix. It's now in dev, and will be part of our next release.

@grevolution
Copy link
Contributor Author

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants