phonegap: cookie based authentication (PHP) not working [webview]

i figured it out:

you have to change the phonegap_delegate.m file and add the following to the init method:


- (id) init
{   
    /** If you need to do any extra app-specific initialization, you can do it here
     *  -jm
     **/
    //special setting to accept cookies via ajax-request
    NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage 
                                          sharedHTTPCookieStorage]; 
    [cookieStorage setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways]; 

    return [super init];
}

it enables webview to accept cookies from ajax requests

Leave a Comment