gpt4 book ai didi

iphone - 在本地通知中存储多个用户信息

转载 作者:行者123 更新时间:2023-12-03 19:36:34 24 4
gpt4 key购买 nike

我正在创建一个 UILocalNotification,我需要为此设置多个 userInfo,我该怎么做?

    // Create a new notification

UIApplication* app = [UIApplication sharedApplication];

UILocalNotification *alarm = [[UILocalNotification alloc] init];

alarm.fireDate = date;
alarm.timeZone = [NSTimeZone localTimeZone];
alarm.alertBody = msg;
alarm.alertAction = @"View";
alarm.repeatInterval = NSYearCalendarUnit;
alarm.soundName=@"happyBirthday.wav";
alarm.applicationIconBadgeNumber = 1;

NSDictionary *userDict = [NSDictionary dictionaryWithObject:detailperson forKey:@"msg"];
NSDictionary *userDictName = [NSDictionary dictionaryWithObject:detailperson2 forKey:@"name"];

alarm.userInfo = userDict;
alarm.userInfo = userDictName;

最佳答案

字典中可以有多个对象,只要键都不同即可:

NSDictionary *userDict = [NSDictionary dictionaryWithObjectsAndKeys:detailperson, @"msg", detailperson2, @"name", nil];

alarm.userInfo = userDict;

关于iphone - 在本地通知中存储多个用户信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10293658/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com