The cause of
Recently, I changed to a new job. I used to do project development with my own computer. The new company gave me Mac Mini with an M1 chip, and I have been familiar with the project recently. In my past development habits, I used the real computer to do project development in the process of development, because I think it will be more convenient, and can reproduce the problems that the simulator cannot reproduce in the real computer. I basically ran the project on a real machine on day one. One day later (I can’t remember exactly what day it was), because the test machine was borrowed, I thought I would use the simulator to have a look, but the question just said hi to me calmly.
To analyze problems
I got an error at compile time, not just a little bit
- First, I thought the problem to see the problem of the simulator, I went to check online related problem, under the domestic search engine can be found in the different technology online solutions to the same problem (this let me think of a very classic advertising, “we don’t produce water, we just the nature of the porter”.) Basically, it is said that the configuration of the project needs to be changed because of problems with the simulator architecture after Xcode upgrade. Need to be in
targe
thebuild setting
Found in theVALID_ARCHS
The keyword of thex86_64
. I checked the project configuration according to relevant Settings and saw that this field had been added to the project. - So let’s move on to the problem…… If you look down, you can see the problem you have encountered before, which is that you can’t find the relevant files for compilation.
It is also easier to solve the problem of introducing some header files in some classes, but the corresponding header file is not found after compilation
It opens at ourCompile Sources
Inside directly check if there is no compilation of that file, if not added to it. But this one is a little bit special, because files that don’t compile arePod
The inside of the. This makes me very upset. At this time, I have not found relevant articles to solve this problem.
To solve the problem
In the boundless article finally found a solution to the problem of the article.
XCODE12 workaround for compiling error when using SIMULATOR
This is the article, after reading, my understanding is. For m1-chip machines, it’s not just tuningtarget
The configuration of thePod
The relevant configuration should also be changed. I am just the first step in the operation of the article, intarget
andpod
thebuild setting
Found in theexcluded architectures
Properties. Since I’m only developing on the simulator, I’m only in itDebug
Increased in modearm64
, as shown in the figure below
After the project, it was, like, running. As for what the article says to be inpodfile
To add that code. I haven’t tested it yet, but if someone has the same problem as me, please try it yourself and let me know the results, or post them in the comments section below 👇🏻.