Start a new topic

Collection.Find() Error after upgrading to Kinvey SDK 3.3.8 - may affect all versions (nil while unwrapping an optional value)

Hi All,

I have gone mad trying to get to the bottom of this one, i did post earlier but i accidentally wrote "3.8.8" instead of "3.3.8". so it may not get approved  (cant see it yet). Forum admin - Please Correct/merge if you do come across it.

To the point... Kinvey updated the iOS SDK to 3.3.8 approx 15th Feb - this caused NO problems (at the time)

Now Realm and Realm swift have been updated (approx 21st Feb) from version 2.4.2 to version 2.4.3.

After updating Pods I found that I was getting a nil Unwrapping when refreshing data i.e. Collection.Find() (first time fetch seems to work for newly logged in users, currently logged in users AND users that are refreshing the list by calling the Collection.Find() function again results in a 'nil while unwrapping an optional value' error).

NOTE: This WILL cause issues for any new Kinvey/iOS users and ALL current Kinvey/iOS users that do a pod 


Here is a image of the main thread Queue on failure:

Main Thread Queue - On Failure

Work around for Users:

in your pod file explicitly specify the version of the Realm and RealmSwift you

  pod 'Realm', '=2.4.2'
  pod 'RealmSwift', '=2.4.2'

Work around for Kinvey:

Im sure you would prefer that your SDK is working for all users without the use of crappy work arounds, in case this takes to long and the fix becomes a matter of urgency, it is possible for Kinvey to explicitly specify in the dependencies to version of Realm and RealmSwift as the .last working version of 2.4.2.

NOTE: i have not created my own pods with dependencies yet, this is just what I have read from this CocoaPods PodSpec documentation.

1 Comment

P.S. I have submitted a pull request there are two lines of code changed in the podSpec file, both Realm and RealmSwift's version numbers have been explicitly specified as 2.4.2 i.e. the working version of the Realm and RealmSwift that were in place at the time of Kinvey's iOS SDK version 3.3.8 release. I will call this a workaround although I don'y know if specifying a version for your dependency comes under the category of workaround or normal practice.

 pod 'Realm', '=2.4.2'
 pod 'RealmSwift', '=2.4.2'

I have no idea where the fault lies in thiscase - could it be with the dependancy release or with the Kinvey SDK? If the fault turns out to be an issue at thats at the dependencies end, this workaround could be kept until a version of Realm/RealmSwift is released that functions accordingly with the Kinvey SDK.

Note: I have only changed dependencies for CocoaPod's podspec file, any other dependancy managed configurations will probably cause it to fail so someone may have to tweak for that.

Here's the link the to Pull Request:

I hope this helps.

Login or Signup to post a comment