You shouldn't need to persist the cookies yourself as suggested in the other answer. NSHTTPCookieStorage
will persist the cookies for you but you need to ensure that the cookies have an expiry date set on the server-side.
Cookies without an expiry date are considered 'session only' and will get cleared when you restart the app. You can check the 'session only' situation via a BOOL property in NSHTTPCookie
. This is standard cookie stuff and not something specific to iOS.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…