This is the code i am about to post a data into my website page but i got this error:
objc[17272]: Class PLBuildVersion is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/AssetsLibraryServices.framework/AssetsLibraryServices (0x1193af998) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices (0x1191d4d38). One of the two will be used. Which one is undefined. ERROR /BuildRoot/Library/Caches/com.apple.xbs/Sources/VectorKit_Sim/VectorKit-1230.31.8.23.3/GeoGL/GeoGL/GLCoreContext.cpp 1763: InfoLog SolidRibbonShader: ERROR /BuildRoot/Library/Caches/com.apple.xbs/Sources/VectorKit_Sim/VectorKit-1230.31.8.23.3/GeoGL/GeoGL/GLCoreContext.cpp 1764: WARNING: Output of vertex shader 'v_gradient' not read by fragment shader
func senddata(_ submit:String, username:String,password:String, email:String, jobtype:String, pay:String){
let myUrl = URL(string: "http://localhost/halloffame/php/senddata.php");
let request = NSMutableURLRequest(url:myUrl!);
request.httpMethod = "POST";
let postString = "submit=\(submit)&jobtype=\(jobtype)&pay=\(pay)";
request.httpBody = postString.data(using: String.Encoding.utf8);
let task = URLSession.shared.dataTask(with: request as URLRequest, completionHandler: { (data:Data?, response:URLResponse?, error:NSError?) -> Void in
DispatchQueue.main.async
{
// if there is an error throw an alert message
if(error != nil)
{
//Display an alert message
let myAlert = UIAlertController(title: "Alert", message: "something wrong", preferredStyle: UIAlertControllerStyle.alert);
let okAction = UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler:nil)
myAlert.addAction(okAction);
self.present(myAlert, animated: true, completion: nil)
return
}
// get feedback from the website
do {
let json = try JSONSerialization.jsonObject(with: data!, options: .mutableContainers) as? NSDictionary
if let parseJSON = json {
// if status is 200
let status = parseJSON["status"] as? String
if(status! == "200")
{
// show the result of the data
let status = parseJSON["status"]
}else {
// display an alert message
let myAlert = UIAlertController(title: "Alert", message: status, preferredStyle: UIAlertControllerStyle.alert);
let okAction = UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler:nil)
myAlert.addAction(okAction);
self.present(myAlert, animated: true, completion: nil)
}
} // end of parseJSON
} catch
{
print(error)
}
}// dispatch
} as! (Data?, URLResponse?, Error?) -> Void).resume() // nsurlsession
the source is the last line of the code, i tried to delete the line as! (Data?, URLResponse?, Error?) -> Void)
but XCODE give me error and suggested to add it back again. if i build a simulator with the code it show no problem until i call the function, then it freeze and gave me this error. this does not happen in swift 2 but only happen once i upgrade.