Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7057091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:56:40+00:00 2026-05-28T03:56:40+00:00

I saw all the post on cookies …still cannot make it work…may be i

  • 0

I saw all the post on cookies …still cannot make it work…may be i m missing some concepts..Gone through apple docs and stack qns…
I want to load a url..”http://example1.com/path1″ in webview in post method where i have to post a cookie .
A cookie which pass a value with name “token” avd value “abcde1234”

firstof all set up application to accept cookies

- (void)applicationDidBecomeActive:(UIApplication *)application{

    [[NSHTTPCookieStorage sharedHTTPCookieStorage]setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];
}

so i created a cookie….

 NSMutableDictionary *cookieProperties = [NSMutableDictionary dictionary];
[cookieProperties setObject:@"token" forKey:NSHTTPCookieName];
[cookieProperties setObject:@"abcde1234" forKey:NSHTTPCookieValue];
[cookieProperties setObject:@"http://example1.com" forKey:NSHTTPCookieDomain];
[cookieProperties setObject:@"http://example1.com/path1" forKey:NSHTTPCookieOriginURL];
[cookieProperties setObject:@"/" forKey:NSHTTPCookiePath];
[cookieProperties setObject:@"0" forKey:NSHTTPCookieVersion];
[cookieProperties setObject:@"0" forKey:NSHTTPCookieSecure];

Log the value with

NSHTTPCookie *cookie1;
NSHTTPCookieStorage *cookieJar = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for (cookie1 in [cookieJar cookies]) {
    NSLog(@"%@", cookie1);
}

and i can see the cookie there fine…
and i am loading the url in the webview “http://example1.com/path1” as

 NSURL *url = [NSURL URLWithString:@"http://example1.com/path1"];   
NSMutableURLRequest *requestObj = [NSMutableURLRequest requestWithURL:url];
[requestObj setHTTPMethod:@"Post"];
[requestObj setHTTPShouldHandleCookies:YES];


//Load the request in the UIWebView.
[webView loadRequest:requestObj];

…but the web shows exeption of missing parameter….that is the cookie that i should enter..
My question is how to set up and make all this working??that is how to setup the cookie for an url,and load in post method in webview??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:56:41+00:00Added an answer on May 28, 2026 at 3:56 am

    I got the problem solved myself…
    The post comment is being called here but miss the statement
    of setting up the post request body..

     NSString *string = [NSString stringWithFormat: @"param=%@&param1=%@", val1,val2];
    [requestObj setHTTPBody: [string dataUsingEncoding: NSUTF8StringEncoding]];
    

    Cookie was setup correctly..

    Not removing the question because it can be used as ref 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I saw this the other day (scroll all the way down to see some
I browsed through all kinds of post related to this topic but the answers
I was searching google for something and saw the post that some one needed
Well. I'm working on an IDE. Some of you maybe saw a post about
I've searched all over and saw different variances. But neither seemed to work for
To all, I was looking at the sample project from http://iphoneonrails.com/ and I saw
Is there any way to compute length of va_list ? All examples I saw
I saw some code like the following in a JSP <c:if test=<%=request.isUserInRole(RoleEnum.USER.getCode())%>> <li>user</li> </c:if>
I saw this post Ruby on Rails - Awesome nested set plugin but I
I saw a similar post on Stack Overflow already, but wasn't quite satisfied. Let's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.