Ios 扩展UILocalNotification
我是iOS的初学者。我尝试扩展UILocalNotification。我的班级在下面Ios 扩展UILocalNotification,ios,objective-c,Ios,Objective C,我是iOS的初学者。我尝试扩展UILocalNotification。我的班级在下面 @interface FSCustomNatification : UILocalNotification typedef enum { FSCustomNatificationPay, FSCustomNatificationWrite, FSCustomNatificationSend } NotificationTypeT; @property (nonatomic, assi
@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的无法识别的选择器。为什么?
FSCustomNatification* localNotification = [[FSCustomNatification alloc] init];
localNotification.typeNotificationT = FSCustomNatificationWrite;
从错误消息的外观来看,
UILocalNotification
是类集群的一部分。文档没有说明(我可以很快看到),但似乎不太可能将UILocalNotification
子类化
相反,您应该使用
UILocalNotification
提供的userInfo
添加您希望在通知触发时可用的任何额外信息。您是否尝试过覆盖init
?它似乎认为localNotification
是UIConcreteLocalNotification
而不是FSCustomNatification
。另外,你的类名中有一个a而不是o。是的,我尝试了overrite init。