編譯器說該方法是一個未解決的標識符。有什麼問題:var boundary=generateBoundaryString()
?Xcode 8 Swift 3爲什麼generateBoundaryString()會產生錯誤?
import UIKit
import Foundation
class ViewController: UIViewController,
UIImagePickerControllerDelegate,
UINavigationControllerDelegate
{
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func sendToServer(_ sender: UIButton) {
let url = NSURL(string: "http://www.example.com/picSaver.php")
var request = URLRequest(url: url! as URL)
request.httpMethod = "POST"
var boundary = generateBoundaryString()
}
編譯器抱怨generateBoundaryString()
是一個未解決的標識符。爲什麼?
什麼錯誤?該功能定義在哪裏? –
錯誤是:使用未解析的標識符。我認爲它是由Import UIKit定義的,但它在IBAction下定義。 – Aleric