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。