扩展UILocalNotification

mol*_*kin 4 objective-c ios

我是iOS的初学者.我尝试扩展UILocalNotification.我的课程如下.

@interface FSCustomNatification : UILocalNotification

typedef enum {
    FSCustomNatificationPay,
    FSCustomNatificationWrite,
    FSCustomNatificationSend
} NotificationTypeT;

@property (nonatomic, assign) NotificationTypeT typeNotificationT;


@end



#import "FSCustomNatification.h"

@implementation FSCustomNatification



@end
Run Code Online (Sandbox Code Playgroud)

当我设置typeNotificationT属性时,我得到 - [UIConcreteLocalNotification setTypeNotificationT:]:无法识别的选择器发送到实例0x8144780.为什么?

FSCustomNatification* localNotification = [[FSCustomNatification alloc] init];
localNotification.typeNotificationT = FSCustomNatificationWrite;
Run Code Online (Sandbox Code Playgroud)

Wai*_*ain 6

通过您的错误消息的外观UILocalNotification是类集群的一部分.文档没有说(我可以很快看到),但你似乎不太可能是子类UILocalNotification.

相反,您应该使用userInfo提供的UILocalNotification来添加您希望在通知触发时可用的任何额外信息.