3lvis / DATAStack

100% Swift Simple Boilerplate Free Core Data Stack. NSPersistentContainer
Other
214 stars 44 forks source link

Travis failiure on swift 4 #110

Closed ghost closed 7 years ago

ghost commented 7 years ago

Hi 3lvis,

Recently upgraded our project to swift 4 and 8.0 if datastack and everything is fine. However when i go to build the project on travis i get the following errors:

/Pods/Sync/Source/DataStack/DataStack.swift:42:64: argument of '#selector' refers to instance method 'mainContextDidSave' that is not exposed to Objective-C
    NotificationCenter.default.addObserver(self, selector: #selector(DataStack.mainContextDidSave(_:)), name: .NSManagedObjectContextDidSave, object: context)

/Pods/Sync/Source/DataStack/DataStack.swift:213:64: argument of '#selector' refers to instance method 'newDisposableMainContextWillSave' that is not exposed to Objective-C
    NotificationCenter.default.addObserver(self, selector: #selector(DataStack.newDisposableMainContextWillSave(_:)), name: NSNotification.Name.NSManagedObjectContextWillSave, object: context)

and...

/Pods/Sync/Source/DataStack/DataStack.swift:241:64: argument of '#selector' refers to instance method 'backgroundContextDidSave' that is not exposed to Objective-C
    NotificationCenter.default.addObserver(self, selector: #selector(DataStack.backgroundContextDidSave(_:)), name: .NSManagedObjectContextDidSave, object: context)

It seems as if the swift 3 @obj inference is being taken into travis as its pulled from cocopods. Im looking into it but do you see these errors on travis ?

ghost commented 7 years ago

To add to this i have confirmed that 8.0.0 is installed on travis and a, wondering if its something to do with the Swift 3 @obj Inference on Travis. Will investigate and feedback here anyway.

ghost commented 7 years ago

Ok managed to recreate it by forcebaly rolling back the Datastack pod to 6.2.0 and trying to compile as swift 3.2 so something weird is happening possibly on travis side and the actual pods are incorrect even though it is telling me that 8.0.0 was installed.

ghost commented 7 years ago

Im closing this as the issue was unrelated to DATAStack and related to Travis

3lvis commented 7 years ago

Hi @jim-dev2rights. Thanks for reporting this issue. Could you share your .travis.yml?

ghost commented 7 years ago

I unfortunately can't as it is under NDA. However i can say what fixed it.

Made sure that in the local .swift-version file matched version 4 as it is in the datastack repo. And used:

osx_image: xcode9
sudo: required

In my Travis YML. Also made sure that i was pulling the latest version in my podfile

pod 'DATAStack', '~> 8'

That seemed to get it to build.