“sending ‘const nsstring *’ to parameter of type ‘nsstring *’ discards qualifiers” warning

“sending ‘const NSString *’ to parameter of type ‘NSString *’ discards qualifiers” warning

在项目中碰到“sending ‘const NSString *’ to parameter of type ‘NSString *’ discards qualifiers” warning,代码如下:

NSString const * ShopListDidClickShopNotification = @"ShopListDidClickShopNotification";

[[NSNotificationCenter defaultCenter] addObserverForName:ShopListDidClickShopNotification object:nil queue:nil usingBlock:^(NSNotification *note) {
//..
}];

期初以为是常量ShopListDidClickShopNotification声明有误,左改右改都没用,后来发现是NSNotificationCenter的调用有问题,正确的方式应该为:

NSString const * ShopListDidClickShopNotification = @"ShopListDidClickShopNotification";

[[NSNotificationCenter defaultCenter] addObserverForName:(NSString *)ShopListDidClickShopNotification object:nil queue:nil usingBlock:^(NSNotification *note) {
     //...
}];