-
-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom objectId before saving #99
Comments
Parse-Swift current doesn't support this. If was briefly mentioned in the forums: https://community.parseplatform.org/t/cant-fetch-objects-with-pointers/1471/5?u=cbaker6 It looks like the JS SDK implemented this here: parse-community/Parse-SDK-JS#1309. My guess is the process is similar to adding it to this SDK. If you would like to open a PR and add the functionality, I can review it. |
I personally have a situation like this, but I just create another field called |
This actually seems pretty easy to add to the SDK, I’ll see if I can find some time later on today to add it |
Great! Let me know how can I buy you a coffee! |
Someone from the server team might have to chime (@dplewis do you have some insight?) in about this particular error. My guess is from the message, it's kind of broad and covers a few different types. Maybe after the PR you won't receive this error anymore.
Thanks for offering, I never had this setup before, but just added it to my GitHub profile. |
Hi, I am trying it now, but I might be missing some point again unfortunately. I added parameter in the init function in the
in the first controllers
and after I try to run following on the same test object as the first post:
the result is a bit longer description:
I double-checked and I have |
Does this mean you were able to save your user with a custom objectId? |
User I did not tried to save with custom Id as this is not required by the app architecture. The user I created and logged in yesterday already |
Setting @dplewis do you have any insight on this? Let me know if I misinterpreted something in the save/update testcases: Parse-Swift/Tests/ParseSwiftTests/ParseObjectCustomObjectId.swift Lines 146 to 200 in 453ebdb
|
In the Back4App dashboard I went to Server Settings --> Core Setting --> Restart App now and seems to not have any effect. I also did clean and build the project in Xcode with the updated SPM library, I forgot to mention in previous post |
I can confirm this is working now. Thank you for your support! |
Awesome! Let us know if you run into any other issues |
Hello,
is there a way how to set custom objectId before the object gets saved into Parse? This does not need to be for user login/sign-up, bot than later for other objects. The reason is that I am allowing user to save objects locally in the app (Realm) before they need or are synced with server, so the Id is already defined.
After login the user I tried following object:
`struct TestParseObject: ParseObject {
}`
saving with this code:
static func testSave() { var testObject = TestParseObject() testObject.itemName = "Able" testObject.objectId = "EaGax1Mnym" testObject.save { (result) in print("save result: \(result)") } }
result is:
save result: failure(ParseSwift.ParseError(code: ParseSwift.ParseError.Code.objectNotFound, message: "Object not found."))
If I do not change objectId, the object saves successfully.
Workaround would be to add one more field and save the other Id in that separate field, but that feels like unnecessary traffic and server load. In the custom server setting I was able to set:
{ "allowCustomObjectId": true }
And I noticed through the community that above functionality should be possible. Looking into the code description I see that there might be some wrong password also:
/** Object doesn't exist, or has an incorrect password. */ case objectNotFound = 101
But the password reference is only for user object, right?
The text was updated successfully, but these errors were encountered: