2017-11-03 1 views
0

Ich möchte Alamofire V4 in meinem Projekt swift 3 hinzufügen. Ich möchte es manuell hinzufügen, wie ich es mit anderen normalen Bibliotheken mache, füge einfach ihren Quellcode in mein Projekt ein. Wie Alamofire manuell hinzufügen, ich möchte es nicht als Framwork/Zielabhängigkeit hinzufügen.Manuelles Hinzufügen von Alamofire mit swift 3

+0

können Sie mit dieser Antwort https://StackOverflow.com/questions/31706589/cannot-add-alamofire-to-swift-project versuchen –

Antwort

0

Sie können auch problemlos mit POD integrieren.

und einfacher Code, um API aufzurufen und Antwort zu behandeln.

import UIKit 

class ViewController: UIViewController { 

    override func viewDidLoad() { 
     super.viewDidLoad() 

     self.API_Formation_Function("[email protected]", password: "password12345") 
    } 


    func API_Formation_Function(_ userName : String , password : String) { 

     EMReqeustManager.sharedInstance.apiLogin(userName, password: password) { 
      (feedResponse) -> Void in 

       // Show your progress HUD here 

      if let downloadError = feedResponse.error{ 

       // Hide progress HUD here and show error if comes 

      } else { 
       if let dictionary = feedResponse.responseDict as? Dictionary<String, AnyObject>{ 

        // Hide progress HUD here and show response 

        let responseModel = EMResponseModel.init(jsonDict: dictionary) 

        print(responseModel) 

       } 
      } 
     } 

    } 

    override func didReceiveMemoryWarning() { 
     super.didReceiveMemoryWarning() 
     // Dispose of any resources that can be recreated. 
    } 
} 

Refer

0

Gibt es einen bestimmten Grund, warum Sie nicht wollen, es mit CocoaPods automatisch zu tun? Lassen Sie sich nicht von der Einrichtung von CocoaPods abbringen. Sobald Sie es installiert haben, ist es wunderbar für die Aktualisierung und Verwaltung Ihrer Addons. Hier ist ein GROSSES Video-Tutorial zur Installation von CocoaPods.

https://www.youtube.com/watch?v=iEAjvNRdZa0&t=2s

Tun Sie sich selbst einen Gefallen und die Zeit nehmen, zu installieren.