以下の内容はhttps://otiai10.hatenablog.com/entry/2014/08/23/095209より取得しました。


【iOS】NSDictionaryからlongを取り出す

ゴール

以下のようなNSDictionaryから"Timestamp"をlongとして値を取り出したい

// *dict
{
    Number = 1408756029;
    Message = "hogeee";
}

解決

NSDictionaryobjectForKeyを使ってから、longLongValueでキャストする

long num = [[dict objectForKey:@"Finish"] longLongValue];

ちなみにNSIntegerとして欲しかったら同様に、integerValueを使う

NSInteger num = [[dict objectForKey:@"Finish"] integerValue];

DRYな備忘録




以上の内容はhttps://otiai10.hatenablog.com/entry/2014/08/23/095209より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14