I am attempting to upload audio files, around 50MB but no larger than 100MB, from the users device to a PHP server. As long as the files are small there's no issue, but these larger files cause the app to crash due to the error: "Terminated due to memory issue". Would implementation of a framework such as AlamoFire be necessary to solve this issue or is there something I missed in the documentation?
Thanks, Here is my code:
- (void)initWithWebRequests:(NSMutableURLRequest *)URLRequest inBlock:(ResponseBlock)resBlock 
{
NSBlockOperation *operation = [NSBlockOperation blockOperationWithBlock:^{
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{
        __block id responseObjects = nil;
        NSLog(@"URL Request:%@",URLRequest);
        NSURLSession *session = [NSURLSession sharedSession];
        NSURLSessionDataTask *task = [session dataTaskWithRequest:URLRequest
                                                completionHandler:
                                      ^(NSData *data, NSURLResponse *response, NSError *error) {
                                          NSString *responseString = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
                                          if (data.length > 0)
                                          {
                                              id allValues = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:&error];
                                              if([(NSDictionary *)allValues count] <= 0)
                                                  responseString = @"Not Available";
                                              responseObjects = allValues;
                                          }
                                          else if(error != nil)
                                          {
                                              responseString = @"Fail";
                                          }
                                          else if(data.length == 0)
                                          {
                                              responseString = @"Not Available";
                                          }
                                          dispatch_sync(dispatch_get_main_queue(), ^{
                                              [[NSOperationQueue mainQueue] addOperationWithBlock:^{
                                                  if (error) {
                                                      resBlock(error, responseObjects, responseString);
                                                  }
                                                  else {
                                                      resBlock(error, responseObjects, responseString);
                                                  }
                                              }];
                                          });
                                      }];
        [task resume];
    });
}];
[operation setQueuePriority:NSOperationQueuePriorityNormal];
[self.operationQueue addOperation:operation];
}