Could not load any Objective-C class information

I am trying to log in a user via API call in iOS(v9.0) using swift language. My User has autoload enabled. When I try to login I get the following error

warning: could not load any Objective-C class information. This will significantly reduce the quality of type information available.

Even though is reported as a warning the app crashes. If I disable the autoload feature, then the login is successful. Do I need to define my classes in a certain way for autoload to work.

Please let me know how to resolve this issue.

Regards

George

Never mind, I figured it out. It was my fault. Apologize for the inconvenience.

Regards,

George

Sorry for going back and forth, but I was testing it with autoload disabled, that is why I thought it was working. Please revert the status and let me know how to solve this.

Regards,

George

Do I have to extend the BackednlessEntityClass in my classes? or NSObject?

Regards,

George

By trial and error, I found in which relationship that is autoload the login fails.

The class I have as a property in my User table is the following

class UserLocation:BackendlessEntity{

var isPrivate:Bool=false

var location:GeoPoint?

var user:BackendlessUser?

}

When this property is set to autoload then the log in fails, when turned off for the specific property then it works. I hope this helps

Hi George,

I just check ‘save/retrieve’ for the UserLocation objects with my sample methods:

 func saveUserLocation() {
 
 let location = UserLocation()
 location.location = GeoPoint()
 location.user = backendless.userService.currentUser
 let dataStore = backendless.data.of(UserLocation.ofClass())
 // save object synchronously
 var error: Fault?
 let result = dataStore.save(location, fault: &error) as? UserLocation
 if error == nil {
 print("UserLocation has been saved: \(result!.objectId)")
 }
 else {
 print("Server reported an error: \(error)")
 }
 }
 
 func retrieveUserLocation() {
 
 let dataStore = backendless.data.of(UserLocation.ofClass())
 dataStore.find(
 {(bc : BackendlessCollection!) -> () in
 let locations = bc.getCurrentPage() as! [UserLocation]
 // import user locations
 for location in locations {
 print ("User: \(location.user)")
 }
 },
 error: { (fault : Fault!) -> () in
 print("Server reported an error: \(fault)")
 })
 }

They work fine for me.
First, I logged in and saved a new UserLocation object:
http://support.backendless.com/public/attachments/371f33061a99b15c16c6b9038cb4571e.png</img>
Then I switch on the autoload checkbox for ‘user’ property, and retrieved it - here is a log:
http://support.backendless.com/public/attachments/fdae1f2d5f059055b53fbb4a003e99ab.png</img>
Maybe you should update the latest Backendless SDK using CocoaPods (3.0.12 release) or github.

Regards,
Slava

Hi Slava,

My project is currently setup manually, not with CocoaPods, I will try to make a new project using Pods and get back to you. One question though, the two lines in the podfile ios-version 8.0 would need to changed if project is designed for 9.0 or 9.1 and so on? to reflect the version number?

Regards,

George

Your Podfile could contain only one line:

pod ‘Backendless-ios-SDK’

Ok, will do.

Actually I was looking over your post, and I did not make myself clear the first time I stated my question. The UserLocation class as I have it, is a property of in the User table also.

So the problem presents when I try to get the property from the logged in user, not the user from UserLocation object, but I will try using the latest sdk using Pods and get back to you.

Regards,

George

Hi Slava,

I just created a new project using pods, I also updated xCode to the latest version, but the issue still remains. When I disable autoload on this specific property login works as expected. When i enable autoload to UserLocation property in my User’s table then the issue re-appears.
What I think its happening is that it goes into an infinite loop, since User has UserLocation object as a property and UserLocation itself has BackendlessUser as its own property. This behavior is noticed only in the iOS version of the sdk, since I have the project already implemented for android and everything works as expected.

Please look into this issue. Thank you in advance.

Regards,

George

Hi Slava,

Any update on this issue? Thank you in advance.

Regards,

George

George,

Do you have a relation defined from Users to UserLocation?

I see in Slava’s screenshot a relation from UserLocation to Users, but you mentioned you’re getting an error with the login operation, which means a User object is being retrieved from the backend. What I am getting at is whether there is a circular dependency between Users -> UserLocation -> Users.

Mark

Hi Mark,
I have a User in UserLocation and a UserLocation in User. As you say, it looks like a circular dependency, but in the android sdk this works as expected. A user has a UserLocation object as its property and a UserLocation has a User property. Is that not allowed in iOS?

Regards,

George

I just stumbled upon this thread on the support forum

http://support.backendless.com/t/swift-relationships-and-broken-object-graph

and looks like the same issue. If yes, maybe I should follow up on that post.
Please let me know.

Regards,

George

There is indeed a problem in the iOS SDK when it comes to circular references. Aside from that having this kind of references in your data model is a bad idea and a sign of over-engineered design.

Mark

Thank you Mark, I will look over my references and see if it is really necessary for me to have both dependencies.
Meanwhile I will be checking on the other post for getting update on this fix, since I saw that it was assigned to be resolved.

Regards,

George

Sure, no problem. No doubt it will be resolved. I am just suggesting a change to get you on the fast track.

Regards,
Mark

Will do! thank you.

Regards,

George

The issue with “circular dependency in the User table and stay logged in is enabled” is fixed.

You should update the latest Backendless SDK with CocoaPods (3.0.16 release) or from github (CommLibiOS & backendless).