Skip to content

Commit 501af91

Browse files
authored
Merge pull request #2342 from woocommerce/issue/2337-product-images-crash-background-uuid
Fix crash when uploading product images after logging in
2 parents 9fb3d9d + 5c012d0 commit 501af91

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Networking/Networking/Network/AlamofireNetwork.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ public class AlamofireNetwork: Network {
1919
///
2020
public required init(credentials: Credentials) {
2121
self.credentials = credentials
22-
let configuration = URLSessionConfiguration.background(withIdentifier: "com.automattic.woocommerce.backgroundsession")
22+
23+
// A unique ID is included in the background session identifier so that the session does not get invalidated when the initializer is called multiple
24+
// times (e.g. when logging in).
25+
let uniqueID = UUID().uuidString
26+
let configuration = URLSessionConfiguration.background(withIdentifier: "com.automattic.woocommerce.backgroundsession.\(uniqueID)")
2327
self.backgroundSessionManager = Alamofire.SessionManager(configuration: configuration)
2428
}
2529

0 commit comments

Comments
 (0)