Create a class at runtime - Why do NSClassFromString AND objc_getclass return nil?

后端 未结 3 1119
南笙
南笙 2021-01-01 06:57

I\'ve tried using both:

NSClassFromString and objc_getclass 

to return a class, so I can create it at runtime, but both functions return ni

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-01 07:34

    I had to manually add the class (e.g. TestClass.m) to the build settings. Build Phases > Compile Sources > + > TestClass.m

提交回复
热议问题