[SWIFT] Crash on release but not on debug

I am having an issue where my app crashes when in release mode but not when in debug mode. Here is the code it’s crashing on :
class func getUserSessions(user: BackendlessUser) -> [BLSession] {

 let whereClause = "user.email = '\(user.email)'"
 let dataQuery = BackendlessDataQuery()
 dataQuery.whereClause = whereClause
 var error: Fault?
 let bc = Backendless.sharedInstance().data.of(BLSession.ofClass()).find(dataQuery, fault: &error)
 if error == nil {
 let sessionList = bc.data
 assert(nil != sessionList)
 assert(sessionList is [BLSession])
 return sessionList as! [BLSession]
 else {
 print("Server reported an error: \(error)")
 return []

Specifically this line is where the crash happens:

return sessionList as! [BLSession]

So I think somehow the system is not returning an array of BLSession, but it only seems to do this in the release build. This makes me suspect that there are differences with how Backendless compiles at debug vs release time, making it difficult to get to the root of the problem.
I am using 3.0.28 of the api.
Any help is appreciated, as always.

Hi, Robert!

Do you get any stacktrace?

Please try this:

                return bc.getCurrentPage() as! [BLSession]

Just tried that and same crash result in release but works 100% in debug.

Any more thoughts on this issue?

I’m completely stuck and am not able to release my app due to this issue.
thank you,


I resolved this issue. Well, I could not resolve this issue so I migrated away from Backendless to Firebase.


Hi Robert,

Please provide your AppId and BLSession class here or to support@backendless.com. We need to copy/paste your BLSession class to our test project for investigating this issue.


And what do you mean saying “in the release build”? Ad Hoc?

When I built and released on Testflight (or using Crashlytics) it would crash, but not when I built the debug version using XCode and placing the app on the device directly. Like I said however, it’s no problem for me anymore as I have replaced all of Backendless with Firebase. Hopefully you’re able to fix the crash but I have no more code references to Backendless as of 2 days ago.

Thanks, Robert. We still need to figure out the problem as other developers may run into the same problem.


I think your Product Name consists of two or more words.
To fix this issue you should set Build Settings → Packaging → Product Name option in the same value as Product Module Name option, for example: