swift 3等价于indexAtPosition,urlRequest.url!.isEqual

时间:2016-10-06 11:17:08

标签: swift xcode swift3 nsindexpath

您好,我在从swift 2.2升级到swift 3时遇到以下错误

  

参数标签'(atPosition:)'不匹配任何可用的重载"

下面是swift 2.2中的以下代码。你们可以帮助我吗?

   $conn =  sfContext::getInstance()->getDatabaseManager()->getDatabase('doctrine')->getDoctrineConnection(); 

    ini_set('memory_limit', '1024M');
    set_time_limit(0);
    try 
    { 

    $conn->beginTransaction();

    foreach ($to as $email => $name)
    {
      if (is_integer($email))
      {
        $email = $name;
      }

      $hash = substr(md5($email), 0, 5);

      //save to cron job

      $html = str_replace(array('[+hash+]', '[+email+]'),array($hash, $email), $content);

      $query = $conn->prepare($sql = "INSERT INTO CronEmail (sendto_name, sendto_email, from_name, from_email, subject, message, created_at)
       VALUES (:sendto_name, :sendto_email, :from_name, :from_email, :subject, :message, :created_at);");


      $query->execute(
        array('sendto_name' => $name,
            'sendto_email' => $email,
            'from_name' => "Newsletter " . $fromsite,
            'from_email' =>  "newsletter@office.ro",
            'subject' => $newsletter->getSubject(),
            'message' => $html,
           'created_at' => date('Y-m-d H:i:s'))
       );

    }

    $conn->commit();

    }catch (Doctrine_Exception $e) { // Rollback if transaction fail 
      $conn->rollback(); 
      echo $sql;  
      echo $e->getMessage();
      die();
    }


    $this->getUser()->setFlash('alert', '<div class="alert_ok">Newsletterul a fost salvat si va fi trimis!</div>');

    $this->redirect('newsletter_send/index');
  }
}

////////////////

1 个答案:

答案 0 :(得分:2)

isEqual错误URL使用==代替isEqual进行比较。

if urlRequest.URL! == strongSelf.request?.urlRequest?.URL {

错误Argument labels '(atPosition:)'

indexPath.index(atPosition: (indexPath as NSIndexPath).length - 1)