- if (iconName) {
- // change to primary icon
- [[UIApplication sharedApplication] setAlternateIconName:nil completionHandler:^(NSError * _Nullable error) {
- if (error) {
- NSLog(@"set icon error: %@",error);
- }
- NSLog(@"The alternate icon's name is %@",iconName);
- }];
- }else{
- // change to alterante icon
- [[UIApplication sharedApplication] setAlternateIconName:@"newIcon" completionHandler:^(NSError * _Nullable error) {
- if (error) {
- NSLog(@"set icon error: %@",error);
- }
- NSLog(@"The alternate icon's name is %@",iconName);
- }];
- }