ios - 扩展 UILocalNotification

标签 ios objective-c

我是 iOS 新手。我尝试扩展 UILocalNotification。我的课在下面。

@interface FSCustomNatification : UILocalNotification

typedef enum {
    FSCustomNatificationPay,
    FSCustomNatificationWrite,
    FSCustomNatificationSend
} NotificationTypeT;

@property (nonatomic, assign) NotificationTypeT typeNotificationT;


@end



#import "FSCustomNatification.h"

@implementation FSCustomNatification



@end

当我设置 typeNotificationT 属性时,我得到 -[UIConcreteLocalNotification setTypeNotificationT:]: unrecognized selector sent to instance 0x8144780。为什么?

FSCustomNatification* localNotification = [[FSCustomNatification alloc] init];
localNotification.typeNotificationT = FSCustomNatificationWrite;

最佳答案

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

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

关于ios - 扩展 UILocalNotification,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18317860/

相关文章:

ios - 启动新屏幕时,带有Swift的Xcode中的线程错误

ios - AFNetworking 1.3.1 图像下载responseObject 为nil

objective-c - 如何安全且对 Apple 友好地将 iOS 应用程序的数据存储在远程数据库中?

ios - Parse.com - 如何跟踪 PFObject 上的操作并更新当前 PFUser

ios - 奇怪的NSURLConnection缓存行为

iphone - 从不同的类创建一个 NSString

ios - Xcode 开发 : save api response for future tests during development

ios - 我可以序列化持有授权 Twitter 帐户的 ACAccount 对象吗?

ios - 是否可以在 UIPageViewController 中以编程方式翻页?

ios - 关闭应用程序后NSTimer是否运行