Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fetched Result Controller delegate not called after swift 1.2 / xcode 6.3 update

I just upgraded my project to swift 1.2. And after 5 or 6 consecutive 'Convert to latest Swift' action :), i was able to make it compiles. Then i had lot's of my UI test failing. It was due to the fact that my 'NSFetchedResultsControllerDelegate' was not called any more.

After (i might say) a very lucky attempt, i found that it as due to the fact that my delegate was not a NSObject. So i was able to fix it by subclassing NSObject or adding @obj.

Before:

class BasicFetchedResultControllerDelegate : NSFetchedResultsControllerDelegate

After:

class BasicFetchedResultControllerDelegate : NSObject, NSFetchedResultsControllerDelegate

I don't think i saw something related to this in the change log. What is the changes that lead to that. Did you notice other changes like this?

like image 281
valR Avatar asked Apr 09 '15 10:04

valR


1 Answers

I received this from Apple after i filled up a bug report:

This issue behaves as intended based on the following:

This is a behavior change in Swift 1.2: methods in non-Objective-C-derived classes will no longer be implicitly marked @objc even if they match an Objective-C protocol. You can explicitly mark the methods with the @objc attribute if you don't want to extend NSObject. This is described in the Xcode 6.3 release notes at https://developer.apple.com/library/ios/releasenotes/DeveloperTools/RN-Xcode/Chapters/xc6_release_notes.html#//apple_ref/doc/uid/TP40001051-CH4-SW3.

like image 76
valR Avatar answered Oct 06 '22 00:10

valR