
[英]App running on Xcode simulator but showing error when connecting my phone
[英]Error when running Xcode simulator - '[framework] CUIThemeStore: No theme registered with id=0'
我正在开发具有单个视图和一些标签的应用程序。 该应用程序在viewdidload()函数上失败,并且无法继续进行。 该代码在下面列出。
override func viewDidLoad() {
super.viewDidLoad()
locationManager.delegate = self
locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters
locationManager.requestWhenInUseAuthorization()
locationManager.startUpdatingLocation()
}
错误为“ [framework] CUIThemeStore:未注册ID = 0的主题”
我在代码中没有使用任何主题或外部框架。 我在MacOS Mojave上运行Xcode 10。 我检查了Xcode中的设置,以查看它是否指向任何外部框架,但找不到任何外部框架。 很感谢任何形式的帮助。
我也遇到同样的问题。
只需将您的图像移动到Assets.xcassets
文件夹即可。
我遇到过同样的问题。 发生这种情况是因为我搞砸了AppDelegate类中的window属性。
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let mainScreen = TaskNumber1()
mainScreen.title = "Task nunber 1"
let navigationController = UINavigationController(rootViewController: mainScreen)
let window = UIWindow(frame: UIScreen.main.bounds)
window.rootViewController = navigationController
window.makeKeyAndVisible()
return true
}
我刚刚创建了新的window属性,但Xcode并没有警告我试图创建与已经创建的同名常量。 但是我只有黑屏,并且和您有同样的错误。 因此,就我而言,解决方案很简单。 要用以下代码替换该窗口代码段:
window = UIWindow(frame: UIScreen.main.bounds)
window?.rootViewController = navigationController
window?.makeKeyAndVisible()
现在,我只是不创建新的窗口变量。
就我而言,与主题无关。 因此,导致此错误的原因也可能在AppDelegate类中。 希望对别人有帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.