问题
I am developing an app with a single view and some labels. The app fails at the viewdidload() func and does not proceed further. The code is listed below.
override func viewDidLoad() {
super.viewDidLoad()
locationManager.delegate = self
locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters
locationManager.requestWhenInUseAuthorization()
locationManager.startUpdatingLocation()
}
The error is '[framework] CUIThemeStore: No theme registered with id=0'
I am not using any themes or external frameworks in my code. I am running Xcode 10 on MacOS Mojave. I checked the setting in Xcode to see if it is referring to any external frameworks and I could not find any. Any help is very much appreciated.
回答1:
I also got the same issue.
Simply move your image(s) to Assets.xcassets folder.
回答2:
I had the same issue. It took place because I messed up with window property in the AppDelegate class.
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
}
I've just created new window property and there was not any warnings from Xcode that I tried to create the constant with the same name as one was created already. But I had just black screen and the same error as you. So in my case solution was simple. To replace that window code snippet with the code below:
window = UIWindow(frame: UIScreen.main.bounds)
window?.rootViewController = navigationController
window?.makeKeyAndVisible()
Now I am simply not creating new window variable.
In my case, there was nothing to do with themes. So the reason of you getting this error is could be in AppDelegate class as well. Hope it will help somebody
来源:https://stackoverflow.com/questions/52860566/error-when-running-xcode-simulator-framework-cuithemestore-no-theme-regist