2015-09-05 1 views
1

Мое приложение отклоняется Apple. Он работает отлично, поскольку ADHOC построен, но падает, когда Apple проводит тестирование. Любая помощь будет оценена.Swift - отклонение от магазина приложений - частичное применение форвардера для повторной абстракции thunk helper

И.М. ошибка получаю (журнал аварии):

12 nFocus Admin     0x100057f0c nFocus_Admin.DescriptionViewController.(sendUpdate (nFocus_Admin.DescriptionViewController) ->() ->()).(closure #1) (DescriptionViewController.swift:109) 
13 nFocus Admin     0x100056bd8 partial apply forwarder for reabstraction thunk helper from @callee_owned (@in (ObjectiveC.NSData!, ObjectiveC.NSURLResponse!, ObjectiveC.NSError!)) -> (@out()) to @callee_owned (@owned ObjectiveC.NSData!, @owned ObjectiveC.NSURLResponse!, @owned ObjectiveC.NSError!) -> (@unowned()) (DescriptionViewController.swift:0) 

Мой код -

func sendUpdate(){ 
      //Activity Indicator 
      activityIndicator = UIActivityIndicatorView (frame: CGRectMake (0, 0, 50, 50)) 
      activityIndicator.center = self.view.center 
      activityIndicator.hidesWhenStopped = true 
      activityIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray 
      view.addSubview(activityIndicator) 
      activityIndicator.startAnimating() 
      UIApplication.sharedApplication().beginIgnoringInteractionEvents() 
      //Make request to server 
      var request = NSMutableURLRequest(URL: NSURL(string: "http://******(actual site value hidden)/sendUpdate.php")!) 
      request.HTTPMethod = "POST" 
      var todaysDate:NSDate = NSDate() 
      var dateFormatter:NSDateFormatter = NSDateFormatter() 
      dateFormatter.dateFormat = "MMMM dd, yyyy" 
      var date:String = dateFormatter.stringFromDate(todaysDate) 
      println(date) 
      dateFormatter.dateFormat = "h:mm a" 
      var time:String = dateFormatter.stringFromDate(todaysDate) 
      println("The time is \(time)") 
      let id = NSUserDefaults.standardUserDefaults().objectForKey("id") as! String! 
      println(id) 
      let postString = "adminId=\(id)&date=\(date)&time=\(time)&site1=\(siteDescriptions[0])&site2=\(siteDescriptions[1])&site3=\(siteDescriptions[2])&site4=\(siteDescriptions[3])&site5=\(siteDescriptions[4])&site6=\(siteDescriptions[5])&site7=\(siteDescriptions[6])&site8=\(siteDescriptions[7])&site9=\(siteDescriptions[8])&site10=\(siteDescriptions[9])&site11=\(siteDescriptions[10])&site12=\(siteDescriptions[11])&site13=\(siteDescriptions[12])&site14=\(siteDescriptions[13])&site15=\(siteDescriptions[14])&site16=\(siteDescriptions[15])&site17=\(siteDescriptions[16])&site18=\(siteDescriptions[17])&site19=\(siteDescriptions[18])&site20=\(siteDescriptions[19])&site21=\(siteDescriptions[20])&site22=\(siteDescriptions[21])&site23=\(siteDescriptions[22])&site24=&site25=" 
      println("\(postString)") 
      request.HTTPBody = postString.dataUsingEncoding(NSUTF8StringEncoding) 
      let task = NSURLSession.sharedSession().dataTaskWithRequest(request) { 
       data, response, error in 
       dispatch_sync(dispatch_get_main_queue()){ 
        self.activityIndicator.stopAnimating() 
        UIApplication.sharedApplication().endIgnoringInteractionEvents() 
       } 

       if error != nil { 
        println("error=\(error)") 
        let alert = UIAlertController(title: "Alert", message: "Please check your internet connection", preferredStyle: .Alert) 
        alert.addAction(UIAlertAction(title: "Ok", style: .Cancel, handler: nil)) 
        self.presentViewController(alert, animated: true, completion: nil) 
        return 
       } 

       var err: NSError? 
       var json = NSJSONSerialization.JSONObjectWithData(data, options: .MutableContainers, error: &err) as? NSDictionary 
       // Did the JSONObjectWithData constructor return an error? If so, log the error to the console 
       if(err != nil) { 
        println(err!.localizedDescription) 
        let jsonStr = NSString(data: data, encoding: NSUTF8StringEncoding) 
        println("Error could not parse JSON: '\(jsonStr)'") 
        let alert = UIAlertController(title: "Alert", message: "Something went wrong. Please try again later.", preferredStyle: .Alert) 
        alert.addAction(UIAlertAction(title: "Ok", style: .Cancel, handler: nil)) 
        self.presentViewController(alert, animated: true, completion: nil) 
       } 
       else{ 
        if(json!["status"] as! String == "success"){ 
         //Message went successfully 
         let alert = UIAlertController(title: "Success", message: "Updates sent successfully", preferredStyle: .Alert) 
         alert.addAction(UIAlertAction(title: "OK", style: .Cancel, handler: { 
          action in 
          self.performSegueWithIdentifier("backToList", sender: self) 
          // siteDescriptions = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""] 
          // self.listTableView.reloadData() 
         })) 
         self.presentViewController(alert, animated: true, completion: nil) 

        }else{ 
         var message = json!["message"] as! String! 
         let alert = UIAlertController(title: "Alert", message: message, preferredStyle: .Alert) 
         alert.addAction(UIAlertAction(title: "Ok", style: .Cancel, handler: nil)) 
         self.presentViewController(alert, animated: true, completion: nil) 
        } 
       } 


      } 
      task.resume() 

    } 

Последняя строка в приведенном ниже фрагменте кода является строка 109 -

alert.addAction(UIAlertAction(title: "OK", style: .Cancel, handler: { 
           action in 
           self.performSegueWithIdentifier("backToList", sender: self) 
           // siteDescriptions = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""] 
           // self.listTableView.reloadData() 
          })) 
          self.presentViewController(alert, animated: true, completion: nil) 

ответ

0

Будучи неспособным решить эту проблему, я обратился к команде обзора Apple. Вскоре после этого они одобрили приложение, и теперь он работает в магазине приложений.

Надеюсь, это поможет кому-то еще.

Смежные вопросы