问题:该应用程序未出现在通知中心,并且在安装完成后无法立即接收推送通知,并且应用程序通过注册推送通知registerForRemoteNotificationTypes:.
细节:
registerForRemoteNotificationTypes每次用户登录时,应用程序都会调用该方法,每次用户分别使用位掩码(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)和UIRemoteNotificationTypeNone.enabledRemoteNotificationTypes 返回正确的值.unregisterForRemoteNotifications在注销时使用了这个方法,但我把它更改为registerForRemoteNotificationTypes:UIRemoteNotificationTypeNone由于怀疑这可能导致问题.任何想法和建议将不胜感激.谢谢!
乍一看,我的问题看起来很简单,但似乎我真的找不到解决方案.它是这样的:我想计算CATextLayer字符串的边界框.这是我做的:
CATextLayer *textLayer = [CATextLayer layer];
textLayer.frame = CGRectMake(80, 0.0f, 36.0f, 18.0f);
textLayer.string = @"12";
textLayer.fontSize = [UIFont systemFontSize];
textLayer.foregroundColor = [UIColor whiteColor].CGColor;
NSLog(@"(width,height)=(%f,%f)",
[textLayer.string sizeWithFont:textLayer.font].width,
[textLayer.string sizeWithFont:textLayer.font].height);
Run Code Online (Sandbox Code Playgroud)
问题是输出总是:(宽度,高度)=(8.000000,0.000000)