Creating an NSDictionary

后端 未结 3 969
灰色年华
灰色年华 2021-01-01 09:18

In the following code, the first log statement shows a decimal as expected, but the second logs NULL. What am I doing wrong?

NSDictionary *entry = [[NSDictio         


        
3条回答
  •  盖世英雄少女心
    2021-01-01 09:54

    new Objective-c supports this new syntax for static initialisation.

    @{key:value}
    

    For example:

    NSDictionary* dict = @{@"x":@(acceleration.x), @"y":@(acceleration.y), @"z":@(acceleration.z), @"date":[NSDate date]};
    

提交回复
热议问题