2014-12-02 46 views
1

我嘗試使用下面的行創建在通知中心一樣的效果,但我不斷收到一個錯誤:試圖通過調用+ notificationCenterVibrancyEffect創建UIVibrancyEffect不過的錯誤時

UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:[UIVibrancyEffect notificationCenterVibrancyEffect]]; 

的錯誤:

2014-12-02 16:30:35.597 Trial[11543:1628621] +[UIVibrancyEffect notificationCenterVibrancyEffect]: unrecognized selector sent to class 0x10569ebe0 
2014-12-02 16:30:35.602 Trial[11543:1628621] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[UIVibrancyEffect notificationCenterVibrancyEffect]: unrecognized selector sent to class 0x10569ebe0' 

我已經進口的通知中心頭文件,但似乎沒有任何解決在運行時這個問題:

#import <NotificationCenter/NotificationCenter.h> 

回答

2

確保您在構建階段下鏈接了NotificationCenter框架。要添加框架,請單擊您的項目,直到您看到設置iOS部署目標的屏幕。一旦你看到該屏幕點擊目標下的第一個選項,你應該看到一個屏幕與你的應用程序的標識符。從那裏點擊「Build Phases」,你會看到一個名爲「Link Binary With Libraries」的彈出式視圖。點擊彈出式視圖,點擊「+」,搜索欄將彈出並進入NotificationCenter。你應該看到框架作爲一個選項,然後點擊框架,以便添加它。

+0

我到底該怎麼做?你可以給我說明或鏈接有指導的文件嗎? – madtapper 2014-12-03 00:18:35

+0

沒關係,明白了。 – madtapper 2014-12-03 00:21:21

+0

好吧。我剛剛做了一個修改。 – 2014-12-03 00:22:28