Weak linking on iPhone refuses to work

后端 未结 2 846
抹茶落季
抹茶落季 2020-12-01 11:20

I\'ve got an iPhone app that\'s mainly targetting 3.0, but which takes advantage of newer APIs when they\'re available. Code goes something like this:

if (UI         


        
2条回答
  •  离开以前
    2020-12-01 11:49

    Aaand I figured it out. For symbols that are not functions (extern const int foobar, for instance), you have to compare against the address of the symbol, not the symbol itself, so:

    if (&UIApplicationWillEnterForegroundNotification != NULL)
        etc;
    

    Which in retrospect is kind of obvious, but I still fault the entire universe around me for not ever mentioning the distinction.

提交回复
热议问题