我从带有AFNetworking的iTunes API获取数据,我想创建一个包含响应的字典,但我不能这样做.
错误:无法将表达式的类型"Dictionary"转换为"Hashable"类型
这是我的代码:
func getItunesStore() {
self.manager.GET( "https://itunes.apple.com/es/rss/topfreeapplications/limit=10/json",
parameters: nil,
success: { (operation: AFHTTPRequestOperation!,responseObject: AnyObject!) in
var jsonResult: Dictionary = responseObject as Dictionary
},
failure: { (operation: AFHTTPRequestOperation!,error: NSError!) in
println("Error:" + error.localizedDescription)
})
}
Run Code Online (Sandbox Code Playgroud) 我正在使用Swift语言和方法创建一个UITableViewController
override func tableView(tableView: UITableView?, cellForRowAtIndexPath indexPath: NSIndexPath?) -> UITableViewCell?
Run Code Online (Sandbox Code Playgroud)
我收到了这个错误
NSIndexPath?在Swift中没有成员名称'row'错误
而且我不明白为什么.
这是我的代码
import UIKit
class DPBPlainTableViewController: UITableViewController {
var dataStore: NSArray = NSArray()
override func viewDidLoad() {
super.viewDidLoad()
self.dataStore = ["one","two","three"]
println(self.dataStore)
}
// #pragma mark - Table view data source
override func numberOfSectionsInTableView(tableView: UITableView?) -> Int {
// Return the number of sections.
return 1
}
override func tableView(tableView: UITableView?, numberOfRowsInSection section: Int) -> Int {
// Return the number of rows in the section.
return self.dataStore.count …Run Code Online (Sandbox Code Playgroud) 有时我在Xcode 6中得到这个错误,画布变成白色.
我是唯一一个发生这种情况的人,还是一个错误?
我正在尝试Swift,我遇到了一些麻烦..我有一个TableViewController.swift和一个DataModel.swift,但我不知道如何将DataModel类导入到TableViewController中以便在其中使用.我正在尝试
import DPBDataModel.swift
Run Code Online (Sandbox Code Playgroud)
但它不起作用(没有这样的模块)
谢谢你的回复!
如何使用Swift调用Facebook代表?Xcode没有自动完成,我不知道如何使用它.
import UIKit
class ViewController: UIViewController,FBLoginViewDelegate {
@IBOutlet var fbLoginView : FBLoginView
override func viewDidLoad() {
super.viewDidLoad()
self.fbLoginView.delegate = self
self.fbLoginView.readPermissions = ["public_profile", "email", "user_friends"]
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
// Facebook Delegates
}
Run Code Online (Sandbox Code Playgroud) 我有一个问题,我需要为iOS应用创建一个API.此API将是私有的,仅适用于iOS App,我不知道我必须使用哪个框架.赖斯?西纳特拉?Rails的API?
你有什么建议?
谢谢!