Get the App
SLTechnology News&Howtos  ›  Development  › 

How to understand the strange problems caused by importing non-OC files

Shulou Source: shulou.com Published: 2022-06-02 03:45:16 10月03日 Update

Today, I will talk to you about how to understand the strange problems caused by the import of non-OC files, which may not be well understood by many people. in order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.

Today, after importing a library file, I suddenly began to report some inexplicable errors.

NSObjCRuntime NSZone NSObject, wait...

At first, I thought that the library file was accidentally corrected by me. I found no problem after setting up an empty project and importing it.

Searching the Internet, I found that a friend and I encountered the same problem and found a solution.

The reason is that when the pch file of the project contains header files globally, I write the import statement outside ifdef _ _ OJBC__, which causes even non-OC files to contain these header files, so the error is reported, and the solution is very simple. Just move the import statement into the ifdefs statement.

Before correction:

After correction:

After reading the above, do you have any further understanding of the strange problems caused by importing non-OC files? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Tags: Documents questions content statements methods projects library documents same inexplicable overall situation reasons right and wrong more friends knowledge articles industry information information channels errors Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi MySQL Linux Microsoft Docker