2014-12-02 47 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