0

Everytime I try to configure the sdk, aka: try MarketingCloudSDK.sharedInstance().sfmc_configure(with:builder) , it crashes with this error:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Cannot create an NSPersistentStoreCoordinator with a nil model'
*** First throw call stack:
(
    0   CoreFoundation                      0x0000000117e40af6 __exceptionPreprocess + 242
    1   libobjc.A.dylib                     0x0000000117cd0e78 objc_exception_throw + 48
    2   CoreData                            0x000000012b3b4f2b +[_PFLock initialize] + 0
    3   MarketingCloudSDK                   0x000000011002e359 -[SFMCDatabase persistentStoreCoordinator] + 724
    4   MarketingCloudSDK                   0x000000011002b910 -[SFMCDatabase setupContexts] + 33
    5   MarketingCloudSDK                   0x00000001100004fd -[MarketingCloudSDKFoundation setupWithConfiguration:error:] + 7571
    6   MarketingCloudSDK                   0x000000010ffc670d -[MarketingCloudSDK frameworkHeavyLiftInitialization:completionHandler:configurationIndex:configurationInfo:defaultFrameworks:weakSelf:] + 472
    7   MarketingCloudSDK                   0x000000010ffc7b34 -[MarketingCloudSDK initializeFrameworks:completionHandler:configurationIndex:configurationInfo:defaultFrameworks:] + 447
    8   MarketingCloudSDK                   0x000000010ffca1b8 -[MarketingCloudSDK configure:configurationInfo:error:jsonFileReadError:url:completionHandler:] + 8392
    9   MarketingCloudSDK                   0x000000010ffc7ef1 -[MarketingCloudSDK sfmc_configureWithDictionary:error:completionHandler:] + 180

The example project works, and I copy-pasted everything from there, so everything is the same. It crashes on every framework version since 7.4.0 (i didn't tried older ones), both cocoapods and xcframeworks.

We are using xcode 12.4, deploymentTarget: 11.0.

Any tips what could cause it?

1 Answer 1

1

This error happens when you bring in the XCFramework but fail to add the MarketingCloudSDK.bundle to Copy Bundle Resources in your target’s Build Phases settings. Please ensure this is present as it holds the core data model needed for the persistent store coordinator.

Please follow all of the steps outlined here to integrate the SDK (either manually or using cocoapods): https://salesforce-marketingcloud.github.io/MarketingCloudSDK-iOS/get-started/get-started-addsdk.html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .