此代码在名为username
caption
caption.text = [NSString stringWithFormat:@"@%@",[data objectForKey:@"username"]];
我希望caption
代替他们device token
显示该用户username
。到目前为止,device token
已在应用中成功使用。
//A different Method that successfully handles the device token
NSMutableDictionary* params =[NSMutableDictionary dictionaryWithObjectsAndKeys:command, @"command", [_dataModel deviceToken], @"token", nil ];
&安培;
//Another different method that successfully handles the device token with a slightly different syntax
NSDictionary *params = @{@"cmd":@"join",
//the red text passes user_id to _datamodels userId method and thusly to api.php's handleJoin function
@"token":[_dataModel deviceToken],
};
问题:如何编写正确的语法来显示令牌,就像objectforkey
值一样?这是我尝试过但我得到编译器警告:no visible interface declaration for selector objectForKey
。我知道这可以做到,怎么做?
caption.text = [NSString stringWithFormat:@"@%@",[data objectForKey:@"token":[_dataModel deviceToken]]];
原始j子:数据
//Method body
-(id)initWithIndex:(int)i andData:(NSDictionary*)data
{
self = [super init];
if (self !=nil)
{
答案 0 :(得分:2)
试试这个:
select ?boosted where {
:r1 a ?x
optional
{
?item rs:boostedBy ?boostedOptional
bind (if(bound(?boostedOptional), ?boostedOptional, "1"^^xsd:integer) as ?boosted)
}
}
答案 1 :(得分:2)
我认为这将解决您的问题
caption.text = [NSString stringWithFormat:@"%@",[params valueForKey:@"token"]];