B.Saravana Kumar
B.Saravana Kumar

Reputation: 1242

My iOS application was crashing in iPhone only but works in iPad

I am installing IPA file in an iPhone and it's crashed, but in iPad it's working fine. And the app working fine in debugging mode (cable connect with xcode). I am unable to find the crashing scenario.

Here I have give the Firebase Crash report screenshot.

enter image description here

enter image description here

enter image description here

My coding screenshot is:

enter image description here

Here I share my code for particular block...

 __weak NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url
                                                       cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:100.0];

[request setHTTPMethod: @"POST"];

NSString *msgLength = [NSString stringWithFormat:@"%lu", (unsigned long)[soapMessage length]];

[request addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[request addValue: [NSString stringWithFormat:@"http://tempuri.org/IEvalProcessService/%@",methodName] forHTTPHeaderField:@"SOAPAction"];
[request addValue: msgLength forHTTPHeaderField:@"Content-Length"];
//[request setHTTPBody: requestData];
[request setHTTPBody: [soapMessage dataUsingEncoding:NSUTF8StringEncoding]];

NSURLSessionConfiguration *configg=[NSURLSessionConfiguration defaultSessionConfiguration];
NSURLSession*sessionn=[NSURLSession sessionWithConfiguration:configg delegate:nil delegateQueue:[NSOperationQueue mainQueue]];

NSURLSessionDataTask *taskk=[sessionn dataTaskWithRequest:request completionHandler:^(NSData *data,NSURLResponse *responce,NSError *error){
    if(error)
    {
        NSLog(@"%@", [error localizedDescription]);
        completionBlock(nil);
    }else{
         NSString *requestReply = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
        NSLog(@"requestReply: %@", requestReply);
        if (![requestReply isEqualToString:@"Object reference not set to an instance of an object."]) {

            //[arrtoSaveInLocal addObject:dictVal];
            if (completionBlock) {
                completionBlock(requestReply);
            }
        }else
        {
            completionBlock(nil);
        }



    }
}];
[taskk resume];

Upvotes: 0

Views: 77

Answers (1)

Florian Burel
Florian Burel

Reputation: 3456

Remove the __weak in front of your request declaration (line 443) It has nothing to do there! :) With it, your request object is not "retain" that is why it crashes...

Upvotes: 1

Related Questions