2010-12-01 27 views
0

可能性の重複:
How to send an NSDictionary (or plist file) as NSData using GameKit bluetooth?PLISTをBluetoothで送信するにはどうすればよいですか?

私は別のものに私のアプリを実行しているデバイスからブルートゥースを通じてplistファイル、またはNSDictionaryのを送信するための簡単な方法を探しています。

どのようにしてPLISTファイルをNSDataに変換しますか(Bluetooth経由で送信可能)、後で変換しますか?

(私は誰かが私はいくつかのコードを始めることができるかどういただければと思います。)

答えて

0

答えは here: https://stackoverflow.com/questions/4107004/how-to-send-an-nsdictionary-or-plist-file-as-nsdata-using-gamekit-bluetooth


あなたがたNSDataにPLISTを変換するために、以下を使用することができますを見つけご覧ください。

`+ (NSData *)dataWithPropertyList:(id)plist format:(NSPropertyListFormat)format options:(NSPropertyListWriteOptions)opt error:(NSError **)error` 

そしてPLISTにNSDataのを変換するために、この:

+ (id)propertyListWithData:(NSData *)data options:(NSPropertyListReadOptions)opt format:(NSPropertyListFormat *)format error:(NSError **)error 
NSPropertyListSerializationクラスの

format最下位バイト数

+0

ああを使用するNSPropertyListBinaryFormat_v1_0ことが、私はだまされやすい人だ可能性があります。ああ – Moshe

関連する問題