问题描述
我是iOS初学者。我尝试扩展UILocalNotification。我的课程如下。
I beginner in iOS. I try extend UILocalNotification. My class below.
@interface FSCustomNatification : UILocalNotification
typedef enum {
FSCustomNatificationPay,
FSCustomNatificationWrite,
FSCustomNatificationSend
} NotificationTypeT;
@property (nonatomic, assign) NotificationTypeT typeNotificationT;
@end
#import "FSCustomNatification.h"
@implementation FSCustomNatification
@end
当我设置typeNotificationT属性时我得到 - [UIConcreteLocalNotification setTypeNotificationT:]:无法识别的选择器发送到实例0x8144780。为什么?
When I set typeNotificationT property I get -[UIConcreteLocalNotification setTypeNotificationT:]: unrecognized selector sent to instance 0x8144780. Why?
FSCustomNatification* localNotification = [[FSCustomNatification alloc] init];
localNotification.typeNotificationT = FSCustomNatificationWrite;
推荐答案
通过错误消息的外观 UILocalNotification
是类集群的一部分。文档没有说(我可以很快看到)但你似乎不太可能继承 UILocalNotification
。
By the looks of your error message UILocalNotification
is part of a class cluster. The docs don't say (that I can see quickly) but it seems unlikely that you should subclass UILocalNotification
.
相反,您应该使用 UILocalNotification
提供的 userInfo
来添加您希望在可用时获得的任何额外信息通知触发。
Instead, you should make use of the userInfo
provided by UILocalNotification
to add any extra information you want to be available when the notification fires.
这篇关于扩展UILocalNotification的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!