Receiver ‘Example’ for class message is a forward declaration??

When met with this error in ObjC project while compiling, it means:

Example class is declared by @class in its invoker's class header but not directly #import.

We have 2 ways to solve this problem:

  • Directly declare Example class by #import “Example.h” in the header.
  • Add a method to return specific Example you want in invoker’s class header. (use this way if you use both ObjC and Swift and Example is a Swift class in a framework project.)

Xcode同一个项目多个target相互依赖的配置方法

e.g. we have 2 targets:

  1. framework: MOJiAppStorePay
  2. debug: DebugMOJiAppStore

if we want to use MOJiAppStorePay in DebugMOJiAppStore, we should config it as follows:

  1. open DebugMOJiAppStore’s settings
  2. under build settings, add MOJiAppStorePay as DebugMOJiAppStore’s dependency
  3. under build settings, unfold Link Binary With Libraries, add MOJiAppStorePay and drag it after its own dependencies (MOJiBase.xc here)