Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1K
Views
Xcode Invalid Swift Parseable Output (Malformed JSON)

I'm getting 4 errors for malformed JSON and one command compileSwift failed with a nonzero exit code error.

I have no clue how to debug this since it doesn't list what file this is occurring in.

screenshot of errors

I have tried deleting the workspace and pods directory and doing a new pod install && pod update.

I have tried deleting the derived data.

Neither have worked.

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

I was getting the same error and after reading above comments i went through my code and saw this "return 93à" So after removing this "à" it's working fine now.

over 4 years ago · Santiago Trujillo Report

0

So here is my story on the exact same issue but a totally different cause and resolution.

TL;DR - Decode that problematic array as a string and read it, that is your real issue, not the one with JSON.

And here is my full story ...

First things first ... I got to this error by moving my app files to a framework project and changing their target.

I tried all you guys suggested, but with no luck, it just took me some time to find out how to report those files recursively. If anyone wants to check their encoding in the whole project, here is how to do that:

find . -type f -name "*.swift" -exec file {} +

All my files reported either ASCII and UTF-8, I even removed all Unicode characters to make them all ASCII, and it still didn't help.

Anyway, totally desperate, I decided on the last attempt ... trying to decode whatever was in that undecodable sequence of bytes.

I opened up my browser console, and did this:

String.fromCharCode(...[123, 10, 32, 32, 34, <the rest of the error array from XCode>])

And it saved my day, giving away the actual problem information.

What I got was the actual error message that for some reason (still unknown to me) the compiler wasn't able to process.

Here is a short extract from which you can also see why all people see the same sequence at the beginning:

{
  "kind": "finished",
  "name": "compile",
  "pid": 27181,
  "output": ...
... /RecognizedSymbolBlock.swift:5:15: error: use of undeclared type 'CGRect'\n    let rect: CGRect;\n ... 
... /RecognizedTextBlock.swift:3:7: error: type 'RecognizedTextBlock' does not conform to protocol 'Decodable'\nclass RecognizedTextBlock ...

So it turned out my problem was not having CoreGraphics framework included in the target, as well as not having it added with import CoreGraphics in the file itself.

Strangely enough, when I looked at that file in XCode (which I didn't do before as it was all just move of a code that worked before), I suddenly got all these errors displayed clearly.

My last weird finding was after I asked myself ... "Why the hell did it work in the original target without the import CoreGraphics?"

It turned out that having this in the bridging header file automatically brought it linked frameworks with it as if they were imported in all my files (it is one of the linked frameworks I use which is using UIKit):

#import <TesseractOCR/TesseractOCR.h>

But it can be anything, really, like:

#import <UIKit/UIKit.h>

The point is if you are using the bridging header file, it may easily hide the fact that you are not being forced to write consistent code with all necessary imports.

Anyway, my primary goal is to let everyone know that their original problem is most probably something totally different and the original issue is actually encoded in that error byte array everyone is getting. Even if you face encoding problems, this byte array may tell you what is wrong with your code.

Happy fixing!

over 4 years ago · Santiago Trujillo Report

0

In the navigator pane, the reports tab (last one) is your go-to for these situations. You can see detailed logs of build actions and can track down from there.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!