UILocalNotification crash

后端 未结 2 1186
清歌不尽
清歌不尽 2020-12-10 20:45

could you please help me ?

I\'m setting up an UILocalNotification and It crashes when I try to set its userInfo dictionary. fetchedObjects contains 88 objects.

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-10 21:26

    Actually, even if using an NSCoding-compliant object, UILocalNotification will throw an NSInvalidArgumentException upon calling setUserInfo. The UILocalNotification apparently keeps a more stringent interpretation of property-list types, in which only the stock objects specified in the Property List Programming Guide are allowed. You can get around this by using NSKeyedArchiver to serialize your custom NSCoding-compliant object to an NSData instance, which may be safely passed to UILocalNotification in the userInfo dictionary.

提交回复
热议问题