我有一个支持iOS8及以后版本的应用程序,内置在Xcode 7中,我使用XIB作为启动屏幕(我没有启动图像)。视图包含一个带有应用版本的UILabel,以及两个带有图像的UIImageViews,这两个图像都出现在images中。xcassets:标志和启动图像。

当我启动应用程序时,UILabel和logo图像显示正确,但如果我在带有iOS9的iPad Air 2上运行应用程序,启动图像就不能显示。我在运行iOS8的Air和Mini上进行了测试,在iPad 2、iPad Air和iPad Air 2的iOS9模拟器上进行了测试,图像在所有这些模拟器上都显示正确。

我运行了一些基本的故障排除,看看我是否能找出发生了什么,但我还没能解决它,我能看到的图像之间的唯一区别是,工作和一个失败的是,当我添加到资产…

以下是我所知道的:

The UIImageView for the splash image is in the correct place, at the correct size. I can tell this because I set its background color to green just to make sure. The view is there, but the image does not appear. So I'm assuming that the view is not to blame. Setting the UIImageView for the splash image to also use the logo image makes the logo image appear in the correct place for the view. This also leads me to assume that the view is not to blame. The UIImage that I am using in the splash image view is used elsewhere in the app and appears fine in those other views (the logo image is also used elsewhere in the app and appears fine). So I'm assuming that the image is valid and having it appear in other views is not a problem. I've confirmed that the settings of the UIImages for the logo and splash in the xcassets file are the same. They are set to Universal, Any width and height, multiple scale factors, rendered as default. There is one difference - the logo has 1x, 2x and 3x scales while the splash image only has 1x and 2x, but I have also tried using UIImages with only 1x, and 1x and 2x values in the UIView and they work (if they were added to the project some time ago). Adding another image of a different size or format (PNG and JPG) to my xcassets and using that UIImage in the UIImageView for the splash image also fails to display. Adding another UIImageView to the XIB file and allocating it a UIImage that was already in the xcassets works, the image appears in the loading screen. Copying and renaming the image files used for the logo and adding them to the project then using that UIImage in the splash view also fails to display. I have tried cleaning the project, restarting the development machine, and deleting the app from the Air 2 and reinstalling it just in case that was a problem.

这最后三个步骤使我相信,在项目文件生命周期的某一点之后添加的图像存在一些问题。当我昨天更新到Xcode 7时,splash图像最初是在Xcode 6中添加的,但logo图像(也添加到Xcode 6中)是在几个月前添加的。

我已经查看了logo图像和splash图像的json文件,它们似乎具有相同的格式。我还浏览了pbxproj文件,寻找不同之处,但我找不到任何不同之处。

所以我想知道是否有人知道为什么我在Air 2上添加的这些新图像在启动屏幕上不显示?我一直在阅读的其他有关未出现图像的问题似乎都与Launch images有关,或与XIB文件中具有关联类的图像有关,这两个问题在这里似乎都不相关。

在ARC下的单例共享实例访问器中使用dispatch_once的确切原因是什么?

+ (MyClass *)sharedInstance
{
    //  Static local predicate must be initialized to 0
    static MyClass *sharedInstance = nil;
    static dispatch_once_t onceToken = 0;
    dispatch_once(&onceToken, ^{
        sharedInstance = [[MyClass alloc] init];
        // Do any other initialisation stuff here
    });
    return sharedInstance;
}

在后台异步实例化单例是不是一个坏主意?我的意思是,如果我请求共享实例并立即依赖它,但dispatch_once直到圣诞节才创建对象,会发生什么?它不会立即返回,对吧?至少这似乎是中央调度的全部意义所在。

他们为什么要这么做呢?

什么是等价的UI_USER_INTERFACE_IDIOM()在Swift检测之间的iPhone和iPad?

我得到一个使用未解决的标识符错误时,在Swift编译。

我正在写一个应用程序,如果用户在打电话时正在看应用程序,我需要改变视图。

我实现了以下方法:

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    NSLog(@"viewWillAppear:");
    _sv.frame = CGRectMake(0.0, 0.0, 320.0, self.view.bounds.size.height);
}

但当应用程序返回前台时,它没有被调用。

我知道我可以实现:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarFrameChanged:) name:UIApplicationDidChangeStatusBarFrameNotification object:nil];

但我不想这么做我更愿意把我所有的布局信息放在viewWillAppear:方法中,并让它处理所有可能的场景。

我甚至尝试调用viewWillAppear: from applicationWillEnterForeground:,但我似乎无法确定在那一点上哪个是当前视图控制器。

有人知道正确的处理方法吗?我肯定我错过了一个显而易见的解决方案。

我显示在一个组表视图内容解析从XML。我想禁用它上的单击事件(我应该不能单击它)表包含两个组。我只想禁用第一组的选择,而不是第二组。点击第二组的第一行导航到我的管播放器视图。

如何使特定的组或行可选?

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{
    if(indexPath.section!=0)
    if(indexPath.row==0)    

    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:tubeUrl]];   
}

谢谢。

我想用Xcode 6在我的应用程序中创建一个UIColor类别。但问题是,在Xcode 6中没有Objective-C分类文件模板。

在Xcode 6中有创建类别的选项吗?

我用Swift写了一个库,但我不能把它导入到我目前用Objective-C写的项目中。

有什么方法可以导入吗?

#import "SCLAlertView.swift" - 'SCLAlertView.swift' file not found

自从我安装了iOS 13.2测试版后,我一直收到一个调试控制台错误消息。每次我在故事板中加载带有WKWebView对象的ViewController时都会发生这种情况。

然后,下面的消息不断显示,而web视图是可见的 ...

2019-10-10 12:10:47.867830+0200 (...) [Process] kill() returned unexpected error 1  
2019-10-10 12:10:47.908698+0200 (...) [Process] kill() returned unexpected error 1  
2019-10-10 12:10:47.908814+0200 (...) [Process] kill() returned unexpected error 1  
2019-10-10 12:10:47.934169+0200 (...) [Process] kill() returned unexpected error 1  
2019-10-10 12:10:47.947668+0200 (...) [Process] kill() returned unexpected error 1  
2019-10-10 12:10:47.964375+0200 (...) [Process] kill() returned unexpected error 1  
2019-10-10 12:10:48.193556+0200 (...) [Process] kill() returned unexpected error 1  
2019-10-10 12:10:48.193723+0200 (...) [Process] kill() returned unexpected error 1  
2019-10-10 12:10:48.193941+0200 (...) [Process] kill() returned unexpected error 1  
2019-10-10 12:10:48.194012+0200 (...) [Process] kill() returned unexpected error 1  
2019-10-10 12:10:48.195679+0200 (...) [Process] kill() returned unexpected error 1  
2019-10-10 12:10:48.200432+0200 (...) [Process] kill() returned unexpected error 1  
2019-10-10 12:10:48.207225+0200 (...) [Process] kill() returned unexpected error 1  
2019-10-10 12:10:48.207298+0200 (...) [Process] kill() returned unexpected error 1 

在我关闭视图的那一刻,我得到了以下消息:

2019-10-10 12:32:41.577505+0200 (...)[ProcessSuspension] 0x1051e50b0 - ProcessAssertion::processAssertionWasInvalidated() 

有时我会在web视图加载的过程中收到以下消息:(我不能说什么时候发生的)

2019-10-10 12:33:11.453528+0200 (...) Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service
2019-10-10 12:33:11.459713+0200 (...) Could not signal service com.apple.WebKit.Networking: 113: Could not find specified service

如果我触摸屏幕,它会重新开始

    2019-10-10 12:10:48.200432+0200 (...) [Process] kill() returned unexpected error 1  
    2019-10-10 12:10:48.207225+0200 (...) [Process] kill() returned unexpected error 1  
    2019-10-10 12:10:48.207298+0200 (...) [Process] kill() returned unexpected error 1 
...

我已经检查了,这是发生在所有的视图控制器与我的应用程序的WKWebViews,所以它似乎不是一个代码错误。

这不会使应用程序崩溃,但我想知道为什么会发生这种情况,如果其他人也有同样的问题。

对象指针的@property声明中强属性和弱属性的区别是什么?

还有,非原子是什么意思?

我添加了一个导航控件在我的应用程序中的视图之间切换。但一些视图不应该有“返回”(前一个标题)按钮。关于如何隐藏后退按钮有什么想法吗?