我有一个可以用SwiftyJSON解析的json:
if let title = json["items"][2]["title"].string {
println("title : \(title)")
}
Run Code Online (Sandbox Code Playgroud)
完美的工作.
但我无法绕过它.我试过两种方法,第一种是
// TUTO :
//If json is .Dictionary
for (key: String, subJson: JSON) in json {
...
}
// WHAT I DID :
for (key: "title", subJson: json["items"]) in json {
...
}
Run Code Online (Sandbox Code Playgroud)
XCode不接受for循环声明.
第二种方法:
// TUTO :
if let appArray = json["feed"]["entry"].arrayValue {
...
}
// WHAT I DID :
if let tab = json["items"].arrayValue {
...
}
Run Code Online (Sandbox Code Playgroud)
XCode不接受if语句.
我究竟做错了什么 ?
这是Place我定义的一个类:
class Place: NSObject {
var latitude: Double
var longitude: Double
init(lat: Double, lng: Double, name: String){
self.latitude = lat
self.longitude = lng
}
required init(coder aDecoder: NSCoder) {
self.latitude = aDecoder.decodeDoubleForKey("latitude")
self.longitude = aDecoder.decodeDoubleForKey("longitude")
}
func encodeWithCoder(aCoder: NSCoder!) {
aCoder.encodeObject(latitude, forKey: "latitude")
aCoder.encodeObject(longitude, forKey: "longitude")
}
}
Run Code Online (Sandbox Code Playgroud)
这就是我试图保存Places 数组的方法:
var placesArray = [Place]
//...
func savePlaces() {
NSUserDefaults.standardUserDefaults().setObject(placesArray, forKey: "places")
println("place saved")
}
Run Code Online (Sandbox Code Playgroud)
它不起作用,这是我在控制台上得到的:
Property list invalid for format: 200 (property lists cannot contain objects …Run Code Online (Sandbox Code Playgroud) 这是一篇非常好的文章,它引用了iOS表情符号及其代码.例如\ue008对于小型相机.
我在我的代码中试过这个:
var myText: String = "\ue008"
Run Code Online (Sandbox Code Playgroud)
xCode不接受此操作.如何包含它?
我本地化了Info.plist:

我得到了这个构建错误:
error: could not read data from '/Users/cherif/Apps/Wesh/Info.plist':
The file “Info.plist” couldn’t be opened because there is no such file.
Run Code Online (Sandbox Code Playgroud)
实际上现在有两个Info.plist文件:
fr.lproj/Info.plist
Base.lproj/Info.plist
Run Code Online (Sandbox Code Playgroud)
如何本地化Info.plist路径?
我为IOS推送通知生成了一个.cer文件,我希望将它与NodeJS HTTPS模块一起使用.
我发现HTTPS模块的唯一例子是使用.pem和.sfx文件,而不是.cer:
var options = {
key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
};
or
var options = {
pfx: fs.readFileSync('server.pfx')
}
https.createServer(options, function (req, res) {
res.writeHead(200);
res.end("hello world\n");
}).listen(8000);
Run Code Online (Sandbox Code Playgroud)
有解决方案吗
当我做 :
cordova plugin add https://github.com/phonegap/phonegap-facebook-plugin.git
Run Code Online (Sandbox Code Playgroud)
我收到错误:
Error: Variable(s) missing: APP_ID, APP_NAME
Run Code Online (Sandbox Code Playgroud)
我在哪里配置这些变量?
我想在一个只有两行可以容纳的小空间中显示文本.当文本太长时,我正在寻找一种在第二行末尾获得省略号的方法.

我用了一张桌子,但它不起作用,我无法限制细胞高度.
<td style="overflow-x: hidden;overflow-y:hidden;text-overflow: ellipsis;max-height:50px">text</td>
Run Code Online (Sandbox Code Playgroud) 在调用CloudCode函数时,我有时会在iOS 8上遇到错误.它有时只会发生,我不明白为什么:
Error: Error Domain=Parse Code=100 "The operation couldn’t be completed. (Parse error 100.)" UserInfo=0x17ed2150
{ Code=100,
error=Error Domain=NSURLErrorDomain Code=-1200 "An SSL error has occurred and a secure connection to the server cannot be made."
UserInfo=0x19d0c750 {
NSLocalizedDescription=An SSL error has occurred and a secure connection to the server cannot be made.,
NSLocalizedRecoverySuggestion=Would you like to connect to the server anyway?,
_kCFStreamErrorCodeKey=-9824,
NSErrorFailingURLStringKey=https://api.parse.com/1/functions/weshread,
_kCFStreamErrorDomainKey=3,
NSUnderlyingError=0x19de4f40 "An SSL error has occurred and a secure connection to the server cannot be made.", …Run Code Online (Sandbox Code Playgroud) 这是我在Parse.com CloudCode上部署的代码:
var now = new Date()
var then = moment(now).subtract(20, "minutes").toDate()
console.log(now)
console.log(then)
Run Code Online (Sandbox Code Playgroud)
为什么now === then?
我究竟做错了什么 ?
这是我的代码:
var express = require('express');
var RedisStore = require('connect-redis')(express);
Run Code Online (Sandbox Code Playgroud)
这是我得到的错误:
RedisStore.prototype.__proto__ = Store.prototype;
^
TypeError: Cannot read property 'prototype' of undefined
at module.exports (/home/cherif/Bureau/Twimbee/server/gamma/node_modules/connect-redis/lib/connect-redis.js:96:41)
at Object.<anonymous> (/home/cherif/Bureau/Twimbee/server/gamma/index.js:2:42)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3
Run Code Online (Sandbox Code Playgroud)
请帮忙
ios ×5
swift ×4
node.js ×2
cordova ×1
cordova-3 ×1
css ×1
date ×1
ellipsis ×1
express ×1
html ×1
html-table ×1
html5 ×1
https ×1
javascript ×1
json ×1
localization ×1
momentjs ×1
node-redis ×1
nsstring ×1
objective-c ×1
redis ×1
ssl ×1
string ×1
swifty-json ×1
xcode ×1