使用Xcode 11 beta 5升级到iOS13 beta 6后,在iPhone SE设备上运行时,我收到此消息。
dyld: Symbol not found: _$s7SwiftUI7BindingVyxGAA0C11ConvertibleAAMc
Referenced from: /var/containers/Bundle/Application/3B128240-B05E-4C1C-A0E1-55D22683B49E/BleAdvApp.app/BleAdvApp
Expected in: /System/Library/Frameworks/SwiftUI.framework/SwiftUI
in /var/containers/Bundle/Application/3B128240-B05E-4C1C-A0E1-55D22683B49E/BleAdvApp.app/BleAdvApp
Run Code Online (Sandbox Code Playgroud)
使用模拟器没有此消息,并且设备上的iOS13 beta 5正常,工具“编译”很好,该消息在iPhone上启动应用程序时显示,并带有
线程1:信号SIGABRT
由于没有Xcode 11 beta 6,因此Xcode仍在MacOS Mojave 10.14.5(18F132)的beta 5上运行。
我从头开始创建了一个简单的SwiftUI示例,该示例在实际的手机和模拟器上都可以正常工作。
我还想知道Mac上根本没有路径/ var / containers吗?
对如何进行有任何想法吗?
在 SwiftUI 5.1 中,我想使用 AppDelegate 创建一个 userData 对象。userData 还将包含 BLE 广告数据,这些数据也将从 AppDelegate 更新。这些数据应该可供 UI 使用以显示这些值。
在 AppDelegate 我使用
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
private var centralManager : CBCentralManager!
var userData: UserData!
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
userData = UserData()
return true
}
Run Code Online (Sandbox Code Playgroud)
在 SceneDelegate 我想传递给视图使用
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
@EnvironmentObject var userData: UserData
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options …Run Code Online (Sandbox Code Playgroud) 我只是迁移使用CoreDate而不是简单的集合。我正在使用iOS13 beta 8和Xcode11 beta 6。
struct BeaconList: View {
@Environment(\.managedObjectContext) var managedObjectContext
@FetchRequest(fetchRequest: fetchRequest(), animation: nil) var beacons: FetchedResults<Beacon>
static func fetchRequest() -> NSFetchRequest<Beacon> {
let request: NSFetchRequest<Beacon> = Beacon.fetchRequest()
request.sortDescriptors = [NSSortDescriptor(key: "id", ascending: true)]
return request
}
func buildView(name: String, beacons: [Beacon]) -> AnyView {
return AnyView (
Section(header: Text(name)) {
ForEach(beacons) { beacon in
BeaconListEntry(beacon: beacon)
}
}
)
}
var body: some View {
TabView {
NavigationView {
List {
buildView(name: "MY BEACONS", beacons: beacons.filter { …Run Code Online (Sandbox Code Playgroud)