Overlapping accesses to 'urlComponents', but modification requires exclusive access

后端 未结 3 2052
Happy的楠姐
Happy的楠姐 2021-01-07 22:47

I am trying to use the Lyft API with iOS 11 and Swift 4, and am receiving an error on the second line, which is

Overlapping accesses to \'urlComponen

3条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-07 23:47

    I guess you need to set first to a local variable and then change it , try this:

    var urlComponents = URLComponents(url: mutableURLRequest.url!, resolvingAgainstBaseURL: false) 
    var localVariable = urlComponents 
    urlComponents?.queryItems = (localVariable?.queryItems ?? []) + queryItems  
    

提交回复
热议问题