Answer the question
In order to leave comments, you need to log in
How to put the result of NSURLSession dataTask into a variable with type NSData?
NSData* data = [session dataTaskWithRequest:request];
Incompatible pointer types initializing 'NSData' with an expression of type 'NSURLSessionDataTask'
Answer the question
In order to leave comments, you need to log in
Read a book on obj-c, or google, finally, you don’t need to fantasize.
You do not even try to understand, but whine that no one is helping you.
[[_session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
//ТУТ ВАШ КОД ДЕЛАЙТЕ С data что душе угодно.
}] resume];
// Либо так:
NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question