Error 1000 when saving an object

Dear all,

In my app I have a functionality to add a new place. Anyone can, no need to be logged in. I save a place with some textfields, the coordinates, a category object for the relationship. That’s all.
Was working pretty well. Yesterday I tried to add a new place, and I now always receive an error 1000 :

fServer reported an error: FAULT = ‘1000’ [Entity with the specified ID cannot be found: Id - ] <Entity with the specified ID cannot be found: Id - >

I had a look here and I saw some of you also got some issues like that, I tried the solutions offered, but still doesn’t work. Is there any reason, is there any change I didn’t notice on server side leading to that error?

Thanks for your help.

Vincent

Small precision… I was able to save other kind of objects in my app, but for these ones, I must be logged in. And it worked perfectly.

So it looks like if a user isn’t logged in, it is impossible to save an object.

Looks like…

Thanks for your help

Hi, Vincent. What is your Application ID ?

Can you also show the example code that reproduces the error?

Hello Anatolii,

I made further tests with a logged in user, no change.

Here is my Application ID : 8F559436-BB68-B56F-FF8F-671AD7E2C700

Here is the code I use to build and save my object (creating a newCompanyCategory and insert it in my Company object may look a bit weird, but the selectedCategory comes from my Realm…) :
func saveNewCompany() {

    // Shows the MBProgress spinner

    let spiningActivity = MBProgressHUD.showHUDAddedTo(self.view, animated: true)

    spiningActivity.labelText = "Saving..."

    spiningActivity.detailsLabelText = "Please wait"

    

    // Creates the Company datastore.

    let newCompany = Company()

    newCompany.companyNamePinyin = self.companyNamePinyinText.text

    newCompany.companyAddPinyin = self.companyAddPinyinText.text

    newCompany.companyAddChinese = self.companyAddChineseText.text

    newCompany.companyDescription = "No description yet..."

    

    let newCompanyCategory = Category()

    newCompanyCategory.objectId = selectedCategory.objectId

    newCompanyCategory.created = selectedCategory.created

    newCompanyCategory.updated = selectedCategory.updated

    newCompanyCategory.categoryId = selectedCategory.categoryId!

    newCompanyCategory.categoryTitle = selectedCategory.categoryTitle!

    

    newCompany.category = newCompanyCategory

    

    newCompany.location = GeoPoint.geoPoint(GEO_POINT(latitude: self.selectedAnnotation.coordinate.latitude, longitude: self.selectedAnnotation.coordinate.longitude), categories: ["companies"], metadata: ["companyName":newCompany.companyNamePinyin!]) as? GeoPoint




    

    let dataStore = backendless.data.of(Company.ofClass())

    

    // save object asynchronously

    dataStore.save(

        newCompany,

        response: { (result: AnyObject!) -> Void in

            let obj = result as! Company

            print("Company has been saved: \(obj.objectId)")

            // Kill the MBProgress spinner

            MBProgressHUD.hideAllHUDsForView(self.view, animated: true)

        },

        error: { (fault: Fault!) -> Void in

            print("fServer reported an error: \(fault)")

            

            // Kill the MBProgress spinner

            MBProgressHUD.hideAllHUDsForView(self.view, animated: true)

            

    })

}

Nothing has changed in this part since quite a long time and it was working really well.
Thanks for your great support as usual!

Vincent

Thanks, Vincent!

We’ll check it (though it can take some time).
BTW, do you use the latest SDK?

I updated the SDK via cocoa pods 3 days ago. That’s the only one change on my side. But I don’t know since when this problem occurs.

Ok then. Thanks for the update.
I was wondering maybe a behavior has change on save method I wasn’t aware of.

Btw, I checked with my testers to try to add records. I am waiting for an update.

Thanks.

Hi again,

Could you please tell me if there is away way I could keep working without screwing up your tests?
Can I create a brand new database? My project is still under development but almost done and I don’t want to loose to much time.

Thanks for your answer, I’ll be able to work on it tomorrow depending on your answer.

Vincent.

Little update :

I just took some time to create a new app in the Backendless console with the minimum.
Doesn’t work either…
I don’t know what’s wrong…

Hi Anatolli,

I’ve made further tests, and sorry if it looks like spam… :frowning:
I just noticed something maybe useful for your researches… I am not able to reach the Geolocation page in the Backendless console… Just tried with different browsers, no luck…

Anatolii,

Little update… I found out why Geolocation wasnt working anymore… just because seems China blocked the map, which is provided by Google… Used to work, but anyway works now with VPN.

  • Besides, I don’t have any idea what’s going on with the 1000 error and I would like to know if it is a known issue from Backendless side ( you forwarded it pretty fast to dev team so I guess it is already known :wink: ).

  • Could you define what do you mean by It may take some time? Roughly?

The point is can I do anything to help? Is it possible that problem could happen later on when the project will be deployed? Just to try to avoid any big problem for the future because right now I am stuck, I can’t work at all on the project, but at least it isn’t released yet.

Thanks for your update.

Hi Vincent,

Please provide your classes: Company, Event and Category, we need to copy/paste them to our test project for investigating this issue.

If you have some sample project which demonstrates this problem, please attach it here or send to support@backendless.com

Regards,
Slava

Hello Vyacheslav,

  • Company :
    class Company: NSObject {

    var objectId: String = “”

    var created: NSDate?

    var updated: NSDate?

    var ownerId: String?

    var companyNamePinyin: String?

    var companyNameChinese: String?

    var companyAddPinyin: String?

    var companyAddChinese: String?

    var companyPhoneNb: String?

    var companyCellphoneNb: String?

    var companyDescription: String?

    var companyImagesURL: String?

    var companyPremium: Bool = false

    var location : GeoPoint?

    var ratingRelation: [Rating]?

    var eventRelation: [Event] = []

    var category: Category?

}

  • Event
    class Event: NSObject {

    var objectId: String?
    var created: NSDate?
    var updated: NSDate?

    var eventTitle: String?
    var eventDescription: String?
    var eventDateStart: NSDate?
    var eventDateEnd: NSDate?
    var eventImageURL: String?
    var deletedFlag: Bool = false

    var companyRelation: Company?

}

  • Category
    class Category: NSObject {

    var objectId: String = “”
    var created: NSDate?
    var updated: NSDate?

    var categoryId: String = “”
    var categoryTitle: String = “”

}

Thanks

Thank you, Vincent, we are working now with this issue. Hope to help you asap.

Vincent, the cause of this issue is a line in your classes

var objectId: String = ""

You should change them to:

 var objectId: String?