Comments (7)
Can you post what the error was and your your fix just in case someone else has the same issue in the future?
Feel free to close this issue
from parse-swift.
Hi @Mammut-Felix, when posting a potential issue, please post the full ParseError
as it often shows where the problem is. You can remove any private info.
Also, is the struct you provided what you actually tested. You originally posted:
struct User: ParseUser, Codable {
var username: String?
var email: String?
var password: String?
var authData: [String: [String: String]?]?
var objectId: String?
var createdAt: Date?
var updatedAt: Date?
var ACL: ParseACL?
var pointerArray: [CustomObject] // Not optional, which will definitely give you an error because all keys should be optional
}
These are not the same...
You can see this answer for more details as from you original post it seems like the same problem.
from parse-swift.
Hi @cbaker6, thanks for your reply.
Yeah I changed the post because I forgot the optional. In my test the array is also optional.
The complete ParseError:
ParseError(code: ParseSwift.ParseError.Code.unknownError, message: "Error decoding parse-server response: Optional(<NSHTTPURLResponse: 0x6000018d9800> { URL: https://parse.endpoint/login } { Status Code: 200, Headers {\n \"Access-Control-Allow-Origin\" = (\n \"*\"\n );\n \"Content-Encoding\" = (\n gzip\n );\n \"Content-Type\" = (\n \"application/json; charset=utf-8\"\n );\n Date = (\n \"Mon, 26 Apr 2021 11:42:53 GMT\"\n );\n Etag = (\n \"W/\\\"1ef-EOV9mGaVgYexdK/WN2AMiTxS3P8\\\"\"\n );\n Server = (\n nginx\n );\n \"Strict-Transport-Security\" = (\n \"max-age=31536000; includeSubDomains; preload\"\n );\n Vary = (\n \"Accept-Encoding\"\n );\n \"access-control-allow-headers\" = (\n \"X-Parse-Master-Key, X-Parse-REST-API-Key, X-Parse-Javascript-Key, X-Parse-Application-Id, X-Parse-Client-Version, X-Parse-Session-Token, X-Requested-With, X-Parse-Revocable-Session, X-Parse-Request-Id, Content-Type, Pragma, Cache-Control\"\n );\n \"access-control-allow-methods\" = (\n \"GET,PUT,POST,DELETE,OPTIONS\"\n );\n \"access-control-expose-headers\" = (\n \"X-Parse-Job-Status-Id, X-Parse-Push-Status-Id\"\n );\n \"content-security-policy\" = (\n \"default-src \'self\' http: https: data: blob: \'unsafe-inline\'\"\n );\n \"referrer-policy\" = (\n \"no-referrer-when-downgrade\"\n );\n \"x-content-type-options\" = (\n nosniff\n );\n \"x-frame-options\" = (\n SAMEORIGIN\n );\n \"x-powered-by\" = (\n Express\n );\n \"x-xss-protection\" = (\n \"1; mode=block\"\n );\n} }) with error: The data couldn’t be read because it is missing. Format: Optional(\"{\\\"objectId\\\":\\\"w6d9Be0kUW\\\",\\\"emailVerified\\\":true,\\\"username\\\":\\\"[email protected]\\\",\\\"accType\\\":\\\"admin\\\",\\\"createdAt\\\":\\\"2021-03-22T13:57:47.210Z\\\",\\\"updatedAt\\\":\\\"2021-04-26T11:41:55.265Z\\\",\\\"email\\\":\\\"[email protected]\\\",\\\"firstname\\\":\\\"firstname\\\",\\\"lastname\\\":\\\"lastname\\\",\\\"pointerArray\\\":[{\\\"__type\\\":\\\"Pointer\\\",\\\"className\\\":\\\"CustomObject\\\",\\\"objectId\\\":\\\"ghB7KjzWSQ\\\"}],\\\"ACL\\\":{\\\"*\\\":{\\\"read\\\":true},\\\"role:Admin\\\":{\\\"read\\\":true,\\\"write\\\":true},\\\"w6d9Be0kUW\\\":{\\\"read\\\":true,\\\"write\\\":true}},\\\"sessionToken\\\":\\\"r:9121a3ece6de6e0588e49b5e187c7ccf\\\"}\")")
At the CustomObject all properties are optional, too.
from parse-swift.
Something doesn't seem right with your code. The error states: The data couldn’t be read because it is missing.
which usually indicates it couldn't decode a required key, but you are saying everything is optional and works when you includeKeys: ["pointerArray"],...
. Are you sure you only have one User
struct and all the keys are optional? What happens when you comment out pointerArray
in your User struct and then login?
struct User: ParseUser, Codable {
var username: String?
var email: String?
var password: String?
var authData: [String: [String: String]?]?
var objectId: String?
var createdAt: Date?
var updatedAt: Date?
var ACL: ParseACL?
//var pointerArray: [CustomObject] // Not optional, which will definitely give you an error because all keys should be optional
}
It looks like your ParseUser
doesn't match your server as your server is giving you back properties like accType
, etc. This shouldn't be causing your issue, but you will need to add them to your User struct if you intend to use them on the client in the future.
All ParseObject
s are Encodable
and Decodable
, you shouldn't need to add Codable
, I would imagine the compiler is giving you warning.
from parse-swift.
Be sure to verify your code against the example in playgrounds:
Querying:
from parse-swift.
I've added another example to ParseUser in playgrounds that uses a ParseObject
array similar to your example called allScores
.
The playground examples work which leads me to believe something is wrong with your code. You should look through the examples and verify your code is setup properly.
from parse-swift.
@cbaker6 Thank you for your support. I've got it going now. The error was actually in the CustomObject
from parse-swift.
Related Issues (20)
- Remove duplicate docs HOT 4
- Allow implementations of ParseObjects to set their own className HOT 7
- Allow implementations of ParseObjects to set their own className HOT 4
- Nested ParseFile saves invalid data HOT 1
- Auto-reuse existing installation object when migrating from ObjC SDK HOT 7
- Add offline object saving HOT 26
- Delete installation is impossible HOT 7
- Parse.User save not dispatching back to callback queue when result is success HOT 5
- 📣 Contributors wanted! HOT 1
- Parse Analytics - Track App Opened HOT 1
- ParseConfig throwing Codable errors when type `Object` exists in Config. HOT 1
- Unable to parse the exact error from ParseError HOT 1
- Fatal error: Duplicate elements of type 'ParseFile' were found in a Set. This usually means either that the type violates Hashable's requirements, or that members of such a set were mutated after insertion HOT 1
- Does not support automatic/anonymous user HOT 1
- When is the next release? HOT 2
- Crash: Installation.current setter not thread safe HOT 1
- Request: Make backingStore optional rather than force unwrapped HOT 2
- PFFacebookUtils' has no member 'initializeFacebookWithLaunchOptions HOT 1
- Count return 0 HOT 1
- Does not build against visionOS target HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from parse-swift.