I have a project from campus, but I tried the webkit error, how do I fix it?

I have a project from college, make a mobile app, I made it for the ios version. I tried to run it in the simulator, it shows the text. but if I try it in real it’s not a simulator. the text doesn’t work, there is an error like that on the webkit, I don’t know why. can anyone help?

I want the text to appear on a real iPhone, not a simulator 🙁

here this code:

class ThirdViewController: UIViewController {
var webView: WKWebView!
var descriptionLabel: UILabel!
var scrollView: UIScrollView!
var contentView: UIView!

override func viewDidLoad() {
    super.viewDidLoad()
    view.backgroundColor = .white
    
    setupScrollView()
    setupWebView()
    setupLabel()
    setupDescription()
    loadVideo()
}

func setupScrollView() {
    scrollView = UIScrollView()
    scrollView.translatesAutoresizingMaskIntoConstraints = false
    view.addSubview(scrollView)
    
    // Set up constraints for the scroll view
    NSLayoutConstraint.activate([
        scrollView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor),
        scrollView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
        scrollView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
        scrollView.bottomAnchor.constraint(equalTo: view.bottomAnchor)
    ])
    
    // Set up the content view inside the scroll view
    contentView = UIView()
    contentView.translatesAutoresizingMaskIntoConstraints = false
    scrollView.addSubview(contentView)
    
    // Set up constraints for the content view
    NSLayoutConstraint.activate([
        contentView.topAnchor.constraint(equalTo: scrollView.topAnchor),
        contentView.leadingAnchor.constraint(equalTo: scrollView.leadingAnchor),
        contentView.trailingAnchor.constraint(equalTo: scrollView.trailingAnchor),
        contentView.bottomAnchor.constraint(equalTo: scrollView.bottomAnchor),
        contentView.widthAnchor.constraint(equalTo: scrollView.widthAnchor)
    ])
}

func setupWebView() {
    webView = WKWebView()
    webView.translatesAutoresizingMaskIntoConstraints = false
    contentView.addSubview(webView)
    
    // Set up constraints for the mini-player in the top-left corner
    NSLayoutConstraint.activate([
        webView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 20),
        webView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 20),
        webView.widthAnchor.constraint(equalToConstant: 200),
        webView.heightAnchor.constraint(equalToConstant: 150)
    ])
    
    // Set corner radius
    webView.layer.cornerRadius = 30
    webView.clipsToBounds = true
}

func setupLabel() {
    let label = UILabel()
    label.translatesAutoresizingMaskIntoConstraints = false
    label.text = "How To Make Nasi Goreng At Home"
    label.font = UIFont.boldSystemFont(ofSize: 18)
    label.numberOfLines = 5
    contentView.addSubview(label)
    
    // Set up constraints for the label
    NSLayoutConstraint.activate([
        label.centerYAnchor.constraint(equalTo: webView.centerYAnchor),
        label.leadingAnchor.constraint(equalTo: webView.trailingAnchor, constant: 20),
        label.trailingAnchor.constraint(lessThanOrEqualTo: contentView.trailingAnchor, constant: -20)
    ])
}

func setupDescription() {
    descriptionLabel = UILabel()
    descriptionLabel.translatesAutoresizingMaskIntoConstraints = false
    descriptionLabel.text = """
    Description
    Ingredients:
    Sweet Soy Sauce
    ¼ cup soy sauce
    4 tbsp brown sugar
    
    Nasi Goreng
    2 tbsp cooking oil
    2 tbsp chopped onion
    2 garlic cloves
    2-3 red chili
    100-gm boneless chicken
    1 tbsp sweet soy sauce
    1 egg
    1 ½ tsp balachaw paste
    1 ½ cup cooked rice
    ¼ tsp turmeric
    1 tsp soy sauce
    ½ tsp pepper
    
    Garnish
    1 tsp fried onions
    1 egg
    
    Instructions:
    1. Simmer soy sauce with brown sugar on low heat until it thickens
    2. Set aside the sweet soy sauce to use for later
    3. Add cooking oil along with chopped onion, garlic cloves, and red chili in pan
    4. Stir for 1-2 minutes
    5. Add bite size chicken pieces and sweet soy sauce
    6. Stir in whisked egg
    7. Add balachaw paste and cooked rice
    8. Add turmeric, soy sauce, salt and pepper to taste
    9. Garnish with a fried onion and a sunny side up before serving
    10. Ready to Enjoy!
    """
    descriptionLabel.font = UIFont.systemFont(ofSize: 16)
    descriptionLabel.numberOfLines = 0 // Allows the label to have multiple lines
    contentView.addSubview(descriptionLabel)
    
    // Set up constraints for the description label
    NSLayoutConstraint.activate([
        descriptionLabel.topAnchor.constraint(equalTo: webView.bottomAnchor, constant: 20),
        descriptionLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 20),
        descriptionLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -20),
        descriptionLabel.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -20)
    ])
}

func loadVideo() {
    // YouTube video URL with autoplay enabled
    let videoURL = URL(string: "https://www.youtube.com/embed/zsNnqYN_a6Y?autoplay=1")!
    let request = URLRequest(url: videoURL)
    webView.load(request)
}

}

class FourViewController: UIViewController {
var webView: WKWebView!
var descriptionLabel: UILabel!
var scrollView: UIScrollView!
var contentView: UIView!

override func viewDidLoad() {
    super.viewDidLoad()
    view.backgroundColor = .white
    
    setupScrollView()
    setupWebView()
    setupLabel()
    setupDescription()
    loadVideo()
}

func setupScrollView() {
    scrollView = UIScrollView()
    scrollView.translatesAutoresizingMaskIntoConstraints = false
    view.addSubview(scrollView)
    
    // Set up constraints for the scroll view
    NSLayoutConstraint.activate([
        scrollView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor),
        scrollView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
        scrollView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
        scrollView.bottomAnchor.constraint(equalTo: view.bottomAnchor)
    ])
    
    // Set up the content view inside the scroll view
    contentView = UIView()
    contentView.translatesAutoresizingMaskIntoConstraints = false
    scrollView.addSubview(contentView)
    
    // Set up constraints for the content view
    NSLayoutConstraint.activate([
        contentView.topAnchor.constraint(equalTo: scrollView.topAnchor),
        contentView.leadingAnchor.constraint(equalTo: scrollView.leadingAnchor),
        contentView.trailingAnchor.constraint(equalTo: scrollView.trailingAnchor),
        contentView.bottomAnchor.constraint(equalTo: scrollView.bottomAnchor),
        contentView.widthAnchor.constraint(equalTo: scrollView.widthAnchor)
    ])
}

func setupWebView() {
    webView = WKWebView()
    webView.translatesAutoresizingMaskIntoConstraints = false
    contentView.addSubview(webView)
    
    // Set up constraints for the mini-player in the top-left corner
    NSLayoutConstraint.activate([
        webView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 20),
        webView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 20),
        webView.widthAnchor.constraint(equalToConstant: 200),
        webView.heightAnchor.constraint(equalToConstant: 150)
    ])
    
    // Set corner radius
    webView.layer.cornerRadius = 30
    webView.clipsToBounds = true
}

func setupLabel() {
    let label = UILabel()
    label.translatesAutoresizingMaskIntoConstraints = false
    label.text = "Anak Anak Jadi Lahap Makan Setelah Di Buat Kan Lele Goreng Kremes, Garing Seharian"
    label.font = UIFont.boldSystemFont(ofSize: 18)
    label.numberOfLines = 5
    contentView.addSubview(label)
    
    // Set up constraints for the label
    NSLayoutConstraint.activate([
        label.centerYAnchor.constraint(equalTo: webView.centerYAnchor),
        label.leadingAnchor.constraint(equalTo: webView.trailingAnchor, constant: 20),
        label.trailingAnchor.constraint(lessThanOrEqualTo: contentView.trailingAnchor, constant: -20)
    ])
}

func setupDescription() {
    descriptionLabel = UILabel()
    descriptionLabel.translatesAutoresizingMaskIntoConstraints = false
    descriptionLabel.text = """
    Description
    CARA MEMBUAT IKAN LELE GORENG KREMES SUPER CRUNCY

    BAHAN BAHAN
    500 Gram Ikan Lele

    Untuk Kremesan nya
    5 Sdm Tepung beras
    2 Sdm Tepung maizena
    1 butir telur
    3 siung bawang putih
    1 Sdm ketumbar bubuk
    1 Sdt kunyit bubuk
    1 Sdt Royco ayam
    1/2 Sdt garam
    1/2 Sdt soda kue
    200 ml air
    """
    descriptionLabel.font = UIFont.systemFont(ofSize: 16)
    descriptionLabel.numberOfLines = 0 // Allows the label to have multiple lines
    contentView.addSubview(descriptionLabel)
    
    // Set up constraints for the description label
    NSLayoutConstraint.activate([
        descriptionLabel.topAnchor.constraint(equalTo: webView.bottomAnchor, constant: 20),
        descriptionLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 20),
        descriptionLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -20),
        descriptionLabel.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -20)
    ])
}

func loadVideo() {
    // YouTube video URL with autoplay enabled
    let videoURL = URL(string: "https://www.youtube.com/watch?v=BS1ViAwnlJ0")!
    let request = URLRequest(url: videoURL)
    webView.load(request)
}

}

class FiveViewController: UIViewController {

var webView: WKWebView!
var descriptionLabel: UILabel!
var scrollView: UIScrollView!
var contentView: UIView!

override func viewDidLoad() {
    super.viewDidLoad()
    view.backgroundColor = .white
    
    setupScrollView()
    setupWebView()
    setupLabel()
    setupDescription()
    loadVideo()
}

func setupScrollView() {
    scrollView = UIScrollView()
    scrollView.translatesAutoresizingMaskIntoConstraints = false
    view.addSubview(scrollView)
    
    // Set up constraints for the scroll view
    NSLayoutConstraint.activate([
        scrollView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor),
        scrollView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
        scrollView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
        scrollView.bottomAnchor.constraint(equalTo: view.bottomAnchor)
    ])
    
    // Set up the content view inside the scroll view
    contentView = UIView()
    contentView.translatesAutoresizingMaskIntoConstraints = false
    scrollView.addSubview(contentView)
    
    // Set up constraints for the content view
    NSLayoutConstraint.activate([
        contentView.topAnchor.constraint(equalTo: scrollView.topAnchor),
        contentView.leadingAnchor.constraint(equalTo: scrollView.leadingAnchor),
        contentView.trailingAnchor.constraint(equalTo: scrollView.trailingAnchor),
        contentView.bottomAnchor.constraint(equalTo: scrollView.bottomAnchor),
        contentView.widthAnchor.constraint(equalTo: scrollView.widthAnchor)
    ])
}

func setupWebView() {
    webView = WKWebView()
    webView.translatesAutoresizingMaskIntoConstraints = false
    contentView.addSubview(webView)
    
    // Set up constraints for the mini-player in the top-left corner
    NSLayoutConstraint.activate([
        webView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 20),
        webView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 20),
        webView.widthAnchor.constraint(equalToConstant: 200),
        webView.heightAnchor.constraint(equalToConstant: 150)
    ])
    
    // Set corner radius
    webView.layer.cornerRadius = 30
    webView.clipsToBounds = true
}

func setupLabel() {
    let label = UILabel()
    label.translatesAutoresizingMaskIntoConstraints = false
    label.text = "Beef And Onion Stir Fry |Tender And Juicy Beef"
    label.font = UIFont.boldSystemFont(ofSize: 18)
    label.numberOfLines = 5
    contentView.addSubview(label)
    
    // Set up constraints for the label
    NSLayoutConstraint.activate([
        label.centerYAnchor.constraint(equalTo: webView.centerYAnchor),
        label.leadingAnchor.constraint(equalTo: webView.trailingAnchor, constant: 20),
        label.trailingAnchor.constraint(lessThanOrEqualTo: contentView.trailingAnchor, constant: -20)
    ])
}

func setupDescription() {
    descriptionLabel = UILabel()
    descriptionLabel.translatesAutoresizingMaskIntoConstraints = false
    descriptionLabel.text = """
    Description
    —-Ingredients(4 servings)—
    6.7 oz/190 g         onion
    4 stalks of green onion
    1/4 tsp       salt
    1/4 tsp       sugar


    4 cloves of garlic
    16.9 oz/480 g        beef
    2 tsp         soy sauce
    2 1/4 tsp   dark soy sauce
    3/4 tsp      oyster sauce
    3/4 tsp      sugar
    1 1/2 tsp    baking soda
    4 1/2 tsp   corn starch

    3 tsp         oil
    1 1/2 tsp   sesame oil

    3 tbsp       oil for cooking
    3 tsp         dark soy sauce
    1 1/2 tsp   oyster sauce
    1 1/2 tbsp cooking wine
    1/3 cup     water
    Black pepper
    """
    descriptionLabel.font = UIFont.systemFont(ofSize: 16)
    descriptionLabel.numberOfLines = 0 // Allows the label to have multiple lines
    contentView.addSubview(descriptionLabel)
    
    // Set up constraints for the description label
    NSLayoutConstraint.activate([
        descriptionLabel.topAnchor.constraint(equalTo: webView.bottomAnchor, constant: 20),
        descriptionLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor, constant: 20),
        descriptionLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant: -20),
        descriptionLabel.bottomAnchor.constraint(equalTo: contentView.bottomAnchor, constant: -20)
    ])
}

func loadVideo() {
    // YouTube video URL with autoplay enabled
    let videoURL = URL(string: "https://www.youtube.com/watch?v=wJ_vNUSQMZg")!
    let request = URLRequest(url: videoURL)
    webView.load(request)
}

}

New contributor

Yizhreel Novanto Tampubolon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật