【问题标题】:NSString Error - Interface type cannot be statically allocatedNSString 错误 - 接口类型不能静态分配
【发布时间】:2011-05-27 20:23:15
【问题描述】:

我正在尝试创建一个 NSDictionary 对象,其中的键定义为歌曲的编号以及信息。尝试定义传递给方法的 NSNumber 时出现上述错误:

+(NSDictionary *) initWithMPMediaItem:(MPMediaItem *) song andSongNumber: (NSNumber *)songCount{

NSString *songKey = @"%@ Song Title", songCount;

【问题讨论】:

    标签: objective-c nsstring nsnumber


    【解决方案1】:

    看起来你想使用:

    NSString *songKey = [NSString stringWithFormat:@"%@ Song Title", songCount];
    

    【讨论】:

    • 感谢您的帮助!现在我知道 stringwithformat 方法的作用了。
    猜你喜欢
    • 2012-01-17
    • 1970-01-01
    • 2014-12-16
    • 1970-01-01
    • 2021-09-21
    • 2021-07-05
    • 1970-01-01
    • 2016-03-05
    • 2021-10-23
    相关资源
    最近更新 更多