Hey guys, I got a really disgusting issue here.
Consider the following Swift code:
print2("TYPE: \(T.ofClass())")
let dataStore = Backendless.sharedInstance().data.of(T.ofClass())
dataStore.find(query, response: { (collection) in
print2("Collection type: \(collection.type())")
guard let entities = collection.getCurrentPage() as? [T] else {
failure?(allowRetry: true, errorMessage: "Unable to retrieve data.")
return
}
success?(entities: entities)
}, error: { (fault) in
print2(" \(self): error retrieving entities: \(fault.detail)")
self.callFailureCompletionHandler(failure, fault: fault)
})
When I build the app with Debug configuration, I see this output:
20:28:22.831: TYPE: Country
20:28:23.555: Collection type: Country
However, on Release configuration the app outputs this:
20:39:04.220: TYPE: Country
20:39:05.411: Collection type: nil
Thus, collection.getCurrentPage() returns an array of NSDictionary, not [T]!
Explicitly setting the type, like collection.type(T) didn’t help: collection.type() starts returning correct value, but there are still NSDictionaries in the array.
Is there any workaround until you fix this issue?
Hi Andrey,
thanks for reporting your issue.
I created an internal ticket assigned to our iOS dev. He will contact with you soon to solve your problem.
Stanislav
Thanks. Can you please mark the ticket as urgent? The build I’ve sent to a customer through TestFlight is not working due to this issue, and he’s thinking to move from Backendless back to Parse.
Marked as critical.
Assigned tag: BKNDLSS-12271
Our dev will help you as soon as possible.
Stanislav
Hi Andrey,
Could you, please, provide your T class here?
Backendless SDK is written on Objective-C, and it requires to follow some rules working with.
Regards,
Slava
class Country: BaseDictionaryModel {
}
class BaseDictionaryModel: BaseModel {
var title = ""
var order = 0
}
func ==(lhs: BaseModel, rhs: BaseModel) -> Bool {
return lhs.objectId == rhs.objectId
}
class BaseModel: NSObject {
var objectId: String = ""
required override init() {}
override var description: String {
return "id: \(objectId)"
}
override func isEqual(object: AnyObject?) -> Bool {
if let object = object as? BaseModel {
return object.objectId == objectId
}
else {
return super.isEqual(object)
}
}
}
We’ve found the problem with Release mode.
The temporary solution - set Bundle Name of your target:
http://support.backendless.com/public/attachments/805fc36352d07079c0d646e0964c6b4d.png</img>
The fixed libs will be uploaded to CocoaPods & github during 2 hour.
This issue is fixed. You could update the latest Backendless SDK from CocoaPods (3.0.13 release) or from github (CommLibiOS & backendless).
I’m still getting the same error. Installing from CococaPods with using:
pod 'Backendless-ios-SDK', :head
The workaround didn’t help neither.
Actually, Debug configuration stopped working as well! I had to switch back to 3.0.11 to get it working.
Ok, Andrey,
I just created a sample project with CocoaPods (3.0.13 release), set Release Run in a scheme, and used your data model classes for save/retrieve operation. This sample works fine for me, I shared it for you.
These are some screenshots:
Regards,
Slava
Your example works fine, by my project still not working.
I’ve prepared a sample project for you: https://drive.google.com/file/d/0B6agzpK_lR6Jcm5tQXBndEhWT28/view?usp=sharing
Please change ‘Build Settings → Packaging → Product Name’ to ‘The37degrees’, for example - and all will be OK:
http://support.backendless.com/public/attachments/81c7da1424eef4c945546425268e16e5.png</img>
But you should update Backendless SDK from CocoaPods (3.0.13 release). I have manually updated it in your sample and shared it back.