-1

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.

Joe
  • 8,868
  • 8
  • 37
  • 59
Alan
  • 329
  • 4
  • 10
  • Possible duplicate of [Class PLBuildVersion is implemented in both frameworks](http://stackoverflow.com/questions/39520499/class-plbuildversion-is-implemented-in-both-frameworks) – Jon Brooks Oct 31 '16 at 04:58
  • sorry, i wasnt sure what is class plbuildversion, but i have just fixed the problem. – Alan Oct 31 '16 at 14:57
  • Please could you tell us how you fix it ? – Snoobie Nov 07 '16 at 21:57

2 Answers2

0

I had a similar error in an iPhone app i'm working on. Resetting the iOS simulator fixed it for me. Simulator -> Reset Content And Settings.

Eric Mentele
  • 864
  • 9
  • 16
-1

i found the solution:

in

   let task = URLSession.shared.dataTask(with: request as URLRequest, completionHandler: { (data:Data?, response:URLResponse?, error:NSError?) -> Void in
            DispatchQueue.main.async

i change it into

let task = URLSession.shared.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
            DispatchQueue.main.async

then i delete the data,response,error in the bottom from this

 } as! (Data?, URLResponse?, Error?) -> Void).resume() // nsurlsession

into this

 }).resume() // nsurlsession
Alan
  • 329
  • 4
  • 10