iosiphoneios8notificationcenteruivibrancyeffect

Trying to create UIVibrancyEffect by calling +notificationCenterVibrancyEffect but an error is caused


I am trying to create the same effect that is in the Notification Centre using the following line but I keep getting an error:

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

The Error:

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'

I have imported Notification Center Header Files, but nothing seems to solve this problem at run time:

#import <NotificationCenter/NotificationCenter.h>

Solution

  • Make sure you linked the NotificationCenter framework under Build Phases. To add the framework click on your project until you see the screen where you set the iOS deployment target. Once you see that screen click on the first option under targets, and you should see a screen with your app's identifier. From there click on "Build Phases" and you should see a pop down view called "Link Binary With Libraries". One you click on the pop down view, click the "+" where a search bar will popup and enter NotificationCenter. You should see the framework as an option and click on the framework so it can be added.