使用IBDesignable使用Swift软件包进行构建期间,来自IB的非常奇怪的错误 [英] Very Strange Errors From IB During Build With Swift Package, Using IBDesignable

查看:69
本文介绍了使用IBDesignable使用Swift软件包进行构建期间,来自IB的非常奇怪的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发了

构建成功,应用运行正常.但是,我想知道这是否会在App Store发行过程中引起问题.

好吧... DUH.这是一个iOS软件包和实用程序,并利用了诸如触觉之类的许多功能.

该软件包明确指出它是iOS(12),我看不到任何说明为什么我的情节提要坚持要尝试渲染为tvOS.

我想念什么?我认为我一定会丢失

I have developed this shared package. It works fine.

In the package test harnesses (3 iOS apps), it works great, and also, the IB storyboard renders the control (It's an IBDesignable).

However, when I include it as a package in another app (I can't share the source), I get these really weird render failure messages:

Error: 'UIPickerView' is unavailable in tvOS

And so on. There's a bunch of "not available in tvOS" errors.

Here's what the log looks like:

The build happens, and the app runs fine. However, I'm wondering if this could cause problems in the App Store release process.

Well...DUH. It's an iOS package and utility, and leverages a lot of things like haptics.

The package explicitly states that it is iOS(12), and I can't see any indication of why my storyboard is insisting on trying to render as tvOS.

What am I missing? I think that I must be missing something from the Package.swift file, but it's pretty straightforward:

import PackageDescription

let package = Package(
    name: "RVS_Spinner",
    platforms: [
        .iOS(.v12)
    ],
    products: [
        .library(
            name: "RVS-Spinner",
            targets: ["RVS_Spinner"])
    ],
    targets: [
        .target(name: "RVS_Spinner")
    ]
)

解决方案

You need to wrap each of these problematic files in

#if os(iOS)

#endif

so that they don't get compiled for other platforms, as things you are referring are only available on iOS.

As far as i know, you can't stop a package from building on all platforms, but you can select which file to be compiled on which platform with the #if os() trick

I think you got confused by the platforms parameter in the Package.swift file. It is not saying where this package is available, it is saying the minimum version required for each platform.

Take a look at Apple's doc for the platforms parameter:

platforms - The list of minimum deployment targets per platform.

这篇关于使用IBDesignable使用Swift软件包进行构建期间,来自IB的非常奇怪的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆