小编Nut*_*tuz的帖子

CFBundleDisplayName返回'null'

我正在尝试将app名称用作NavController标题,但无论我做什么,我都无法获得CFBundleDisplayName值.它返回'null'.

这是我正在使用的代码

[NSBundle mainBundle] infoDictionary][@"CFBundleDisplayName"]
Run Code Online (Sandbox Code Playgroud)

已检查的捆绑包=只有一个.Xcode5/dev目标是iOS5.我没有检查过设备.使用模拟器.

谢谢!

objective-c ios info-plist ios5 xcode5

12
推荐指数
1
解决办法
3238
查看次数

我可以减少重复声明中的代码吗?

有没有办法减少Obj-C中重复声明的代码?

例如:

我有

    localNotification.fireDate = self.dueDate;
    localNotification.timeZone = [NSTimeZone defaultTimeZone];
    localNotification.alertBody = self.text;
    localNotification.soundName = UILocalNotificationDefaultSoundName;
Run Code Online (Sandbox Code Playgroud)

它可以简化为这样的东西吗?

 localNotification
    .fireDate = self.dueDate;
    .timeZone = [NSTimeZone defaultTimeZone];
    .alertBody = self.text;
    .soundName = UILocalNotificationDefaultSoundName;
Run Code Online (Sandbox Code Playgroud)

谢谢!

cocoa-touch objective-c ios

2
推荐指数
1
解决办法
180
查看次数

标签 统计

ios ×2

objective-c ×2

cocoa-touch ×1

info-plist ×1

ios5 ×1

xcode5 ×1