AFNetworking 2.0 add headers to GET request

Here’s an example using AFNetworking 2.0 AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; manager.responseSerializer = [AFJSONResponseSerializer serializer]; manager.requestSerializer = [AFJSONRequestSerializer serializer]; [manager.requestSerializer setValue:@”calvinAndHobbesRock” forHTTPHeaderField:@”X-I do what I want”]; [manager GET:@”http://localhost:3000″ parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) { NSLog(@”JSON: %@”, responseObject); } failure:^(AFHTTPRequestOperation *operation, NSError *error) { NSLog(@”Error: %@”, error); }]; The key are the following 2 lines: manager.requestSerializer … Read more

Request failed: unacceptable content-type: text/html using AFNetworking 2.0

This means that your server is sending “text/html” instead of the already supported types. My solution was to add “text/html” to acceptableContentTypes set in AFURLResponseSerialization class. Just search for “acceptableContentTypes” and add @”text/html” to the set manually. Of course, the ideal solution is to change the type sent from the server, but for that you … Read more

‘Project Name’ was compiled with optimization – stepping may behave oddly; variables may not be available

If your project is using Swift, there are two separate “Optimization Level” settings in the project/target configuration. Make sure you set them both correctly: Select your project in the Project Navigator pane Select your project’s settings under the “PROJECT” tree Click “Build Settings” tab Search for “Optimization Level” and you’ll see two settings, one for … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)