Can't complete step 5 of the the Interfacing with UIKit tutorial

I have got up to step 5 but now get this error: failedToGetInstalledApplicationInfoAfterInstalling


What do I need to do to resolve this?

Replies

This is my code in the view I am trying to preview:


import SwiftUI


struct PageView<Page: View>: View {

var viewControllers: [UIHostingController<Page>]


init(_ views: [Page]) {

self.viewControllers = views.map { UIHostingController(rootView: $0) }

}


var body: some View {

PageViewController(controllers: viewControllers)

}

}


struct PageView_Preview: PreviewProvider {

static var previews: some View {

PageView()

}

}

Since your ViewController is named PageView, try adjusting the UIHostingController<Page> to UIHostingController<PageView> and try it again.


Dan

Hi Dan,

Unfortunately this still generates the same error.

This sounds like a communication error between Xcode and either the simulator or the device (whichever you're using to launch the app). If it's the simulator, I'd quit & relaunch Xcode and the simulator both to see if that remedies the issue. If that doesn't do it you're likely looking at a problem with a background service, and the easiest way to restart that is to either log out & back in or to just reboot your Mac. That's not the official solution, but a side-effect is that whatever app is failing will be quit & restarted if you do that.


If this is happening when running on the device, then I'd suggest opening the Xcode Devices & Simulators window (Cmd-Shift-2) and making sure that your device, when attached, is definitely present there and Xcode isn't presenting any warning or error symbols. If there are some warnings showing, those will usually include instructions on how to go about remedying it. If everything looks normal there, then again you're looking at a background process problem, and again the simplest way to make those stop & restart is to reboot either the device, the Mac, or both (the background process could be on either, so try one, then try another if it persists).


If all that fails, post here & we can discuss other ways forward to try & determine why it's happening, or at least to gather more diagnostic information to send to Apple.

>What do I need to do to resolve this?


I would first try doing a 'clean build folder' via Xcode's Product menu. Hold the option when selecting that menu if you don't see that choice at first.


This is a simple, common remedy with Xcode, that only takes a moment to attempt, so be sure to keep it in mind when these type of issues surface in the future, especially when balks at otherwise simple changes, etc. that don't seem to take immediate effect.


Still no joy, confirm your IDE such as free space on your drive and maximum physical ram.


Good luck.