在后台实现了定时器,如下所示,并使用XCode 4.5.2
UIDevice *device = [UIDevice currentDevice];
BOOL backgroundSupported = NO;
if ([device respondsToSelector:@selector(isMultitaskingSupported)]) {
backgroundSupported = YES;
}
if (backgroundSupported)
{
bgTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
[[UIApplication sharedApplication] endBackgroundTask:bgTask];
}];
/*timer code goes here*/
}
Run Code Online (Sandbox Code Playgroud)
我的应用程序在后台运行,我applicationDidEnterBackground在AppDelegate 中的方法中有上面的代码,并在gdb中获取以下消息
无法endBackgroundTask:标识符4不存在后台任务,或者它可能已经结束.在UIApplicationEndBackgroundTaskError()中断以进行调试.
我知道这个问题类似于不能endBackgroundTask但没有答案或建议.有任何想法吗 ?
任何人都可以帮我启用uibutton的"show High onlight"属性.我知道我们可以在xib编辑器中查看.但它没有用.我们还有其他选择来实现吗?
我知道通过以下方式将边框设置为按钮,
button.layer.cornerRadius = 0.0;
button.layer.borderWidth = 2.5;
button.layer.borderColor = [[UIColor darkGrayColor] CGColor];
Run Code Online (Sandbox Code Playgroud)
但我需要知道如何删除或删除按钮的边框?
谢谢