20160827

node 返回json数据

var http = require('http');

var data = {key: 'value', hello: 'world'};

var srv = http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'application/json'});
  res.end(JSON.stringify(data));
});

srv.listen(8080, function() {
  console.log('listening on localhost:8080');
});

iOS 真机调试

进入xcode,菜单栏选择xcode –> preferences (快捷键 command + ,)在Accounts选项卡添加自己的Apple ID,然后按步骤操作。