Xcode通过php发布到mysql工作从模拟器,但不是从设备

I thought I had cracked my code while working on the train today as everything worked on the simulator, but when I got home to test my code on a device it doesn't work.

I use the following code to post into mysql database:

NSString *urlString = [NSString stringWithFormat:@"http://mywebsite/loginToApp.php?email=%@&password=%@", email.text, password.text];
NSData *dataURL = [NSData dataWithContentsOfURL:[NSURL URLWithString:urlString]];
NSString *returnedString = [[NSString alloc] initWithData:dataURL encoding:NSUTF8StringEncoding];
NSLog(@"urlString %@", urlString);
NSLog(@"dataURL %@", dataURL);
NSLog(@"%@", returnedString);

Which works great from the simulator and logs:

2015-06-24 02:22:55.489 AppName[7339:1140365] urlString http://mywebsite/loginToApp.php?email=test&password=pass 2015-06-24 02:22:55.489 AppName[7339:1140365] dataURL <436f7272 65637420 70617373 776f7264> 2015-06-24 02:22:55.489 AppName[7339:1140365] Correct password

However, when I run this on a device it logs:

2015-06-24 02:22:55.489 AppName[7339:1140365] urlString http://mywebsite/loginToApp.php?email=test&password=pass 2015-06-24 02:28:15.654 AppName[739:122099] dataURL (null)

I have no idea why this isn't working and any help is greatly appreciated :)