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

  • SEARCH
  • Home
  • 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 7903153
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:40:32+00:00 2026-06-03T09:40:32+00:00

I am implementing forget password service in which I would pass an email address

  • 0

I am implementing forget password service in which I would pass an email address and it would return JSON to acknowledge about the sent email. The issue is that I am unable to read the response string in json, and my exception message is shown that data parameter is nil, but if I view the url in my web browser the service looks fine as mentioned below.
my code is:

NSURL *url = [LokalmotionCommonTask getURLForgotPassword:emailFieldTxt.text];

    NSData* data = [NSData dataWithContentsOfURL: url];

    @try {
        NSError* error;
        NSDictionary* jsonDict = [NSJSONSerialization 
                                  JSONObjectWithData:data //1
                                  options:0 
                                  error:&error];

        NSLog(@"%@", [jsonDict objectForKey:@"response"]);
    }
    @catch (NSException *exception) {
        NSLog(@"forgot password exception: %@: %@", [exception name], [exception reason]);
    }

and the service response I get in my web browser is like this:

{"status":400,"response":"Your request to change password is already sent. Please check your email."}

Exception:

forgot password exception: NSInvalidArgumentException: data parameter is nil
  • 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-06-03T09:40:33+00:00Added an answer on June 3, 2026 at 9:40 am

    in Objective-C exceptions are only used for fatal errors, not recoverable errors. Instead just check for nil data:

    If you need to know what was the reason for failure, use:

    NSError* error;
    NSURL *url = [LokalmotionCommonTask getURLForgotPassword:emailFieldTxt.text];
    NSData* data = [NSData dataWithContentsOfURL: url options:NULL error:&error];
    if (data) {
        NSDictionary* jsonDict = [NSJSONSerialization 
                                  JSONObjectWithData:data //1
                                  options:0 
                                  error:&error];
        NSLog(@"%@", [jsonDict objectForKey:@"response"]);
    }
    else {
        NSLog(@"forgot password error, %@", [error localizedFailureReason]);
    }
    

    There is a naming convention error: getURLForgotPassword:
    A method name that begins with “get” implies that there will be a return by reference parameter. Better to just name the method: forgotPasswordURL:

    These two things, exceptions and accessors prefixed with get are a basic difference from Jave.

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

Sidebar

Related Questions

When implementing the Strategy Pattern, where does one put the code that determines which
When implementing a class, is it better practice to return a value for methods
When implementing the ISerializable interface in C#, we provide a constructor which takes a
Implementing a web service that uses Transport-level security with WCF over HTTP is pretty
Is there a way of implementing a rule in mysql which will block updates
Possible Duplicate: Forgot Password: what is the best method of implementing a forgot password
When implementing a singleton in C++, is it better for GetInstance() to return a
Implementing the ScriptControlClass was extremely easy, unfortunately the side effects with the language implementation
implementing publishActivity in PHP using the REST API using this code: $activity = array(
Implementing a custom membership provider, there are certain properties such as MinRequiredPasswordLength that only

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.