macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

decodeInt64ForKey:

INDEX>Foundation>NSCoder>

キーでint64をデコードします
-(int64_t)decodeInt64ForKey:(NSString *)key:

解説

キーでint64をデコードします。
キー付きのアーカイブはNSKeyedArchiverとNSKeyedUnarchiverを使います。
サブクラスで-allowsKeyedCodingをオーバーライドしてYESを返さなければいけません。

返り値

( int64_t )

整数値

引数

( NSString * )key

キー

クラス

NSCoder

Instance Methods

使用可能

10.2

参照

例文

#import "MyView.h"

@implementation MyView

//アンアーカイブするときの手順の記述
- (id)initWithCoder:(NSCoder *)decoder
{
    NSLog([NSString stringWithFormat:@"%d",(int)[decoder decodeInt64ForKey:@"key"]]);
    return self;
}
//アーカイブするときの手順の記述
- (void)encodeWithCoder:(NSCoder *)encoder
{
    [encoder encodeInt64:123456 forKey:@"key"];

}
@end