Does setAlternateIconName: works on background?

The alternateIcon is a very cool feature that can make your user open up your app again if you change for something that the user may be interested.


For example, mother's day is coming and I would like to change to a mother's day themed app icon but I don't want to do it after the user clicks. Actually, I want to use this tool as a way to attract mothers that may see a change on her homescreen.


Doing it after the app opens makes the feature useless for us.


Our idea is to change the icon when the app is on background using a silent notification push that calls the


application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void)


When I try to do this, I receive the following message:


017-04-26 15:38:39.183996-0300 AMARO[1495:318456] [] nw_socket_get_input_frames recvmsg(fd 11, 1024 bytes): [57] Socket is not connected
2017-04-26 15:38:39.184197-0300 AMARO[1495:318456] [] nw_socket_write_close shutdown(17, SHUT_WR): [57] Socket is not connected
2017-04-26 15:38:39.184228-0300 AMARO[1495:318456] [] nw_endpoint_flow_service_writes [9.1 54.243.46.38:443 ready socket-flow (satisfied)] Write request has 0 frame count, 0 byte count
2017-04-26 15:38:39.190500-0300 AMARO[1495:319685] [] tcp_connection_write_eof_block_invoke Write close callback received error: [89] Operation canceled
2017-04-26 15:38:39.191146-0300 AMARO[1495:318456] [] nw_socket_get_input_frames recvmsg(fd 17, 1024 bytes): [57] Socket is not connected
2017-04-26 15:38:39.191918-0300 AMARO[1495:318456] [] nw_endpoint_handler_add_write_request [8.1 104.16.207.165:443 failed socket-flow (satisfied)] cannot accept write requests
2017-04-26 15:38:39.192693-0300 AMARO[1495:319685] [] tcp_connection_write_eof_block_invoke Write close callback received error: [22] Invalid argument
Error Domain=NSCocoaErrorDomain Code=3072 "A operação foi cancelada."


Is this a feature limitation, a bug or we did something wrong? Do we have another way do it?

You must call

setAlternateIconName
only in view controller, and in main thread.
Does setAlternateIconName: works on background?
 
 
Q