-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SwiftyJSON @ 11fdc5c doesn't exist #32
Comments
I'm suffering from this too, there seems to be no Swift 2.0 support with SwiftyJSON yet. Also, |
I ended up with a solution that works great in Swift 2.0 and Xcode 7. I just made a little modification to the file in order to resolve the NSError issue. https://gist.github.com/gabovanlugo/c1c0588ab929df81b3a7 You need to import that file into your project tree manually (no CocoaPods). However, don't forget to install Alamofire and SwiftyJSON for Swift 2.0 Here's my Podfile:
In this example you can see how I'm using it. override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
// Mark: API call
let url = "http://192.168.0.100:3000"
var templateRemoteData: JSON = [:]
Alamofire.request(.GET, url)
.responseSwiftyJSON({ (request, response, json, error) in
if(error != nil) {
print(error)
print(request)
print(response)
}
else {
self.templateRemoteData = JSON!(json)
print(self.templateRemoteData)
// My API returns a ["data"] object, don't forget to change it to whatever you need
for item in self.templateRemoteData["data"].arrayValue {
// Do whatever you want with your remote data
}
}
}
})
} Need to mention that you need to import:
... in your ViewController as well. Another thing, I'm getting data from a local server I did with Node.js, it isn't HTTPS so you can get some warning coming from Xcode 7. You can solve it this way: http://stackoverflow.com/questions/31254725/transport-security-has-blocked-a-cleartext-http Hope it helps. |
Thanks @gabovanlugo |
No problem, @GUMARELO. By the way, for those who are already in OS X "El Capitan", there's a known bug (Even in Xcode 7.1 - 7B91b) that does't allow us to connect to a localhost through an IP address.
Simple solution as the Xcode Release Notes says (As for October 2015): Simulator "When running in the Simulator, an app cannot communicate with TCP/IP services locally hosted by the Mac via the Mac’s local IP address.
More info here: https://forums.developer.apple.com/thread/20919 Of course, if anyone is having such problem. |
Thanks @gabovanlugo Closing for now. |
I'm trying to use this repo in CocoaPods but there's an error retrieving the mentioned version of SwiftyJSON. I think it's just matter of pointing to the right tree.
The text was updated successfully, but these errors were encountered: