Group Group Group Group Group Group Group Group Group

Your First iOS and SwiftUI App · Running the App on Your Device | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4919757-your-first-ios-and-swiftui-app/lessons/47

The background images of the buttons don’t show up when running the app on my device (13.1.1):

It works on the simulator.

Ditto. Apparently it’s rendering those images as Templates instead of as Original by default, but not in the simulator or the Canvas. Weird. Here’s the fix:

The issue seems to be due to the NavigationView proprieties. The buttons will take the overlay colour while in the NavigationView but only on the device.

Adding .buttonStyle(PlainButtonStyle()) to the NavigationView in SceneDelegate will solve this issue.

If anyone’s seeing the issue with the buttons showing up as blue rather than using the background image, see the author notes / forum discussion on the video for the solution: Your First iOS and SwiftUI App · Styling the Buttons and Slider | raywenderlich.com

I can build successfully on the simulator, but I’m getting a “build failed” when I attempt to deploy to my device. I can see my phone under Devices and Simulators, and it’s authenticated and trusted on my Mac.

If your phone isn’t trusting the developer, go to Settings > General > Profiles & Device Management and trust your Apple ID. It took me 30 minutes to figure that out so hopefully this helps you guys!

1 Like

@alexperse Do you still have issues with this?

@swivelio Thank you for sharing your solution - much appreciated! :]

I had the same issue. Maybe it’s just this version of Xcode that I’m using (Version 11.5 (11E608c)), but I’m not allowed to build to my device without having a Development Team set.

Which you fix by selecting your apple ID which should be available in the “Team” field on the Signing & Capabilities page (I only added my AppleID during this tutorial, so I was unable to select a team when first creating the App).

The app deployed and runs on my iPhone 7+ … Yay!

Problem: slider and buttons extend off the physical screen. The phone screenshot looks exactly like the 8+ Sim and Swift UI preview - not ideal. Catalina 10.15.5 & Xcode 11.5

I found an Apple Forum & Quora saying Xcode [still] can’t do landscape SwiftUI previews (Xcode 12 will perhaps?), and @rwenderlich mentioned this in an earlier lesson, but what needs to be done to fix the app to display correctly on an iPhone 6/7/8+?

Thx! -Tim

@timcolson Do you still have issues with this?

@sarahwo Thank you for sharing this - much appreciated!

Thanks for the reply. (I was not notified of even these moderator replies. I’ll check forum settings.)

Yes, sadly, the same. No replies here, so no change. Is this situation unique to my system?

@timcolson

Hi Tim, I had the same issue. I resolved it by adding in .padding(.leading, 20) and .padding(.trailing, 20) to the HStack