将设备令牌发送到mysqlPHP xCode Swift

时间:2015-12-18 23:05:32

标签: xcode swift

在我更新Xcode swift 2后,这个命令确实有用,请帮帮我

如果用户运行应用程序然后将链接发送到appDelegate然后将发送到php以添加mysql但现在确实在新的Xcode版本上工作,就像这个命令 var url:NSString =“http://wwww.maktoob.ga2h.com/Push/regsterID.php?deviceToken=(deviceTokenString)”

----下面的代码---

let characterSet: NSCharacterSet = NSCharacterSet( charactersInString: "<>" )



    let deviceTokenString: String = ( deviceToken.description as NSString )

        .stringByTrimmingCharactersInSet( characterSet )

        .stringByReplacingOccurrencesOfString( " ", withString: "" ) as String



    print( deviceTokenString )



    var url:NSString = "http://wwww.maktoob.ga2h.com/Push/regsterID.php?deviceToken=\(deviceTokenString)"

    print("http://maktoob.ga2h.com/Push/regsterID.php?deviceToken=\(deviceTokenString)")



    url = url.stringByReplacingOccurrencesOfString("", withString: "%20")

    url = url.stringByReplacingOccurrencesOfString("/n", withString: "%0A")

    let data = NSData(contentsOfURL: NSURL(string: url as String)!)

    var result = NSString(data: data!, encoding: NSUTF8StringEncoding)

}

0 个答案:

没有答案