The problem is the following: In my application, you can log in through various social services. network. If the account in social. networks are recorded on different emails, then the input account will be different, and accordingly the token received from the server will be different. When I get a token, I save it to the user defaults, so that later when loading a certain screen I use it. And when I change accounts (but do not exit the application), I always get a new token (the token corresponding to this account) and everything defaults to the user and it works fine. But when I try to load a specific screen, then I have an old token in my dictionary. The dictionary I use to use it in the query. But when I exit the application and re-enter, then the correct token from user defaults is written to my dictionary.
The dictionary looks like this:
var parameters = ["api_token": "\(token!)"] Tried and updated like this:
parameters.updateValue("\(token!)", forKey: "api_token") Why it happens? Does not want to change.
Generally a strange topic. Why does my vocabulary generally remain when I exit a function?! Although it is cluss func