简体   繁体   中英

ASIHTTPREQUEST not working as expected in iOS 8.3

I have used asihttprequest classes in my app for calling web-api.

But now it's not working in iOS 8.3 as well as in iOS 11+ and already full app was developed so can't change whole asihttprequest to a.networking so I need some solution in asihttprequest only.

I want to add that when I am calling api using startAsynchronous it's not working but when I am using startSynchronous it's working fine but for a while it freezes the app.

Once request sent it's not come back with any response not failed or success.

I am using ASIFormDataRequest to call api like this.

 NSString *stringurl=[NSString stringWithFormat:@"%@%@",kBaseUrl,kForgotPasswordAPI];
    NSString * encodedUrl = [stringurl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]];
    NSURL *url = [NSURL URLWithString:encodedUrl];
    requestForgotPassword = [ASIFormDataRequest requestWithURL:url];
    [requestForgotPassword setRequestMethod:@"POST"];
    [requestForgotPassword setPostValue:@"mobile" forKey:@"environment"];
    [requestForgotPassword setPostValue:txtEmailAddress.text forKey:@"email_address"];
    [requestForgotPassword setTimeOutSeconds:60];
    [requestForgotPassword setDelegate:self];
    [requestForgotPassword startAsynchronous];

Finally I have found the answer as i describe my problem i am facing problem while calling web-Api using ASIHTTPREQUEST.

Now what i have done to solve that issue is i have change api calling time like first i am calling api in viewDidLoad() but now i have calling api in viewDidAppear() and it's working fine for me.

If anyone else facing same problem please try this solution and please don't use this ASIHTTPREQUEST class in next project.

Thank you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM