iPhone チャット アプリケーションを作成しています。
ブラウザから iPhone に JSON チャット メッセージを送信する場合:
{"content":"Hi"}
iPhone は以下を受け取ります。
{"content":{"0":72,"1":105,"length":2}}
ただし、まったく同じメッセージを受信することを意図しています。
この問題を再現するには、まず node.js と redis をインストールします。それで:
コードを取得します。
git clone git://github.com/acani/acani.git cd acani git submodule update --initデフォルトのポートで Redis を起動します。
http://github.com/acani/acani-nodeから:
node acani-node-server.js # run node.js chat server # open index.html in a Google Chrome or Firefox and follow instructions.http://github.com/acani/acani-chat/tree/master/Lovers2/にある Lovers.xcodeprojを開き、LoversAppDelegate.m を変更して、HomeViewController ではなく ChatViewController を最初にロードします。
homeViewController = [[HomeViewController alloc] init]; # comment out this line # change the next line to: navigationController = [[UINavigationController alloc] initWithRootViewController:[[ChatViewController alloc] init]]; # Then, build & run.