macOS development-error expected expression (space problem)

Article directory


question

A simple code to find files in the sandbox fails to compile, which is very frustrating.
Insert image description here


try

It is certain that the NSBundle code is written in this way, and an error is still reported even if it is typed again; if
the position is changed, even the mainBundle cannot prompt it.

Restarting Xcode does not solve this problem.


Solution

Group friends suggested that it might be a space problem;
I modified the spaces in the code and removed everything before and after the code, and finally no more errors were reported.
It may be that the code on the web page is copied and there are invisible characters.


Iori 2023-12-21 (KFC Thursday)

Guess you like

Origin blog.csdn.net/lovechris00/article/details/135127583