IBM Support

PH32967: WKHTTPCOOKIESTORE OBJECT IS NOT GETTING UPDATED WITH THE COOKIES IN IOS APPLICATION

Subscribe to this APAR

By subscribing, you receive periodic emails alerting you to the status of the APAR, along with a link to the fix after it becomes available. You can track this item individually or track all items by product.

Notify me when this APAR changes.

Notify me when an APAR for this component changes.

 

APAR status

  • Closed as program error.

Error description

  • In an iOS application built with WKWebview, if the adapter call
    has been made which returns cookie in the adapter response.
    The
    NSHTTPCookie Object is getting updated, However
    WKHTTPCookieStore Object is not getting updated with the cookie
    which is recived from the adapter response.
    
    Below is a sample
    of the output when the app revies cookie from adapter endpoint.
    Notice that sample=examplevalue is held insidethe
    NSHTTPCookieStorage but not in the WKHTTPCookieStore:
    
    
    2020-10-02 09:56:00.049317-0400
    MFPStarterCordova[17506:210332] Response Content :
    2020-10-02
    09:56:00.051703-0400 MFPStarterCordova[17506:210332]
    WL_REQUEST
    2020-10-02 09:56:00.051845-0400
    MFPStarterCordova[17506:210332] [DEBUG] [OCLogger] Client Logs
    successfully sent to server.
    2020-10-02 09:56:00.056196-0400
    MFPStarterCordova[17506:210332] Response Content :
    2020-10-02
    09:56:00.057336-0400 MFPStarterCordova[17506:210332]
    WL_REQUEST
    2020-10-02 09:56:00.057447-0400
    MFPStarterCordova[17506:210332] [DEBUG] [OCLogger] Analytics
    data successfully sent to server.
    2020-10-02
    09:56:06.308210-0400 MFPStarterCordova[17506:210332]
    NSHTTPCookies --> <NSHTTPCookie
    version:0
    name:foo
    value:bar
    exp
    iresDate:'(null)'
    created:'2020-10-02 13:55:04 +0000'
    sessionOnl
    y:TRUE
    domain:mfp.primericaonline.com
    partition:none
    sameSite:no
    ne
    path:/
    isSecure:FALSE
    path:"/" isSecure:FALSE>
    2020-10-02
    09:56:06.308648-0400 MFPStarterCordova[17506:210332]
    NSHTTPCookies --> <NSHTTPCookie
    version:0
    name:sample
    value:exam
    plevalue
    expiresDate:'(null)'
    created:'2020-10-02 13:55:57 +0000
    '
    sessionOnly:TRUE
    domain:mfp.primericaonline.com
    partition:none
    
    sameSite:none
    path:/mfp/api/adapters/CookieAdapter
    isSecure:FAL
    SE
    path:"/mfp/api/adapters/CookieAdapter"
    isSecure:FALSE>
    2020-10-02 09:56:06.309660-0400
    MFPStarterCordova[17506:210332] WKHTTPCookies --> <NSHTTPCookie
    
    version:1
    name:foo
    value:bar
    expiresDate:'(null)'
    created:'2020-
    10-02 13:55:04 +0000'
    sessionOnly:TRUE
    domain:mfp.primericaonlin
    e.com
    partition:none
    sameSite:none
    path:/
    isSecure:FALSE
    path:"/
    " isSecure:FALSE>
    

Local fix

  • Manually add the cookies from NSHTTPCookie Object to
    WKHTTPCookieStore Object in native code whenever the adapter
    call has been made like below:
    
    if (@available(iOS 11.0,
    *)) {
     NSArray *cookies= [[NSHTTPCookieStorage
    sharedHTTPCookieStorage] cookies];
     for (NSHTTPCookie *cookie
    in cookies) {
    
    [wkWebView.configuration.websiteDataStore.httpCookieStore
    setCookie:cookie completionHandler:^{}];
     }
    }
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:                                              *
    * Users of iOS Application built with WKWebview which uses     *
    * HTTP cookies in the communication                            *
    ****************************************************************
    * PROBLEM DESCRIPTION:                                         *
    * In an iOS application using WKWebView, cookie returned by an *
    * adapter call is not getting updated with WKHTTPCookieStore   *
    * Object. But same being updated with NSHTTPCookie Object.     *
    *                                                              *
    * Sample output when the app receives cookie from adapter      *
    * endpoint as follows. Note the cookie sample=examplevalue     *
    * which is missing in WKHTTPCookieStore and present in         *
    * NSHTTPCookieStorage.                                         *
    *                                                              *
    *                                                              *
    * 2020-10-02 09:56:06.308210-0400                              *
    * MFPStarterCordova[17506:210332] NSHTTPCookies -->            *
    * <NSHTTPCookie                                                *
    * version:0                                                    *
    * name:foo                                                     *
    * value:bar                                                    *
    * expiresDate:'(null)'                                         *
    * created:'2020-10-02 13:55:04 +0000'                          *
    * sessionOnly:TRUE                                             *
    * domain:mfp.primericaonline.com                               *
    * partition:none                                               *
    * sameSite:none                                                *
    * path:/                                                       *
    * isSecure:FALSE                                               *
    * path:"/" isSecure:FALSE>                                     *
    *                                                              *
    * 2020-10-02 09:56:06.309660-0400                              *
    * MFPStarterCordova[17506:210332] WKHTTPCookies -->            *
    * <NSHTTPCookie                                                *
    * version:1                                                    *
    * name:foo                                                     *
    * value:bar                                                    *
    * expiresDate:'(null)'                                         *
    * created:'2020-10-02 13:55:04 +0000'                          *
    * sessionOnly:TRUE                                             *
    * domain:mfp.primericaonline.com                               *
    * partition:none                                               *
    * sameSite:none                                                *
    * path:/                                                       *
    * isSecure:FALSE                                               *
    * path:"/" isSecure:FALSE>                                     *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    

Problem conclusion

  • APAR fixed the code path to update WKHTTPCookieStore Object with
    HTTP cookies received from the MobileFirst adapter response in
    the iOS Apps using WKWebview.
    

Temporary fix

  • Manually add the cookies from NSHTTPCookie Object to
    WKHTTPCookieStore Object in native code whenever the adapter
    call has been made like below:
    
    if (@available(iOS 11.0,
    *)) {
     NSArray *cookies= [[NSHTTPCookieStorage
    sharedHTTPCookieStorage] cookies];
     for (NSHTTPCookie *cookie
    in cookies) {
    
    [wkWebView.configuration.websiteDataStore.httpCookieStore
    setCookie:cookie completionHandler:^{}];
     }
    }
    

Comments

APAR Information

  • APAR number

    PH32967

  • Reported component name

    MOBILE1ST PLATF

  • Reported component ID

    5725I4301

  • Reported release

    800

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2020-12-24

  • Closed date

    2021-02-03

  • Last modified date

    2021-02-03

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    MOBILE1ST PLATF

  • Fixed component ID

    5725I4301

Applicable component levels

[{"Line of Business":{"code":"LOB45","label":"Automation"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSZH4A","label":"IBM Worklight"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"800"}]

Document Information

Modified date:
04 February 2021