0

The following line seems to always have a syntax error, any idea on how to fix it?

sourceModel = NSManagedObjectModel.mergedModelFromBundles(nil, forStoreMetadata:metaData) 

Error is "Extra argument forStoreMetadata in call"

The if I try the following

sourceModel = NSManagedObjectModel.mergedModelFromBundles( forStoreMetadata:metaData)

I get a "Missing argument for parameter #1 in call"

What gives?

1 Answer 1

1

bundles in mergedModelFromBundles definition is not optional.So you cannot pass nil instead you need to pass array containing bundles

//bundles is not optional class func mergedModelFromBundles(bundles: [AnyObject], forStoreMetadata metadata: [NSObject : AnyObject]) -> NSManagedObjectModel? 

try instead

 sourceModel = NSManagedObjectModel.mergedModelFromBundles([NSBundle.mainBundle()], forStoreMetadata: metaData) 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.