gpt4 book ai didi

ios - iOS swift 尝试使用 Ensembles 时出错

转载 作者:可可西里 更新时间:2023-10-31 23:44:47 26 4
gpt4 key购买 nike

我使用 pod 成功添加了 Ensembles,并且编译没有错误。现在我将代码添加到我的 AppDelegate.swift 文件中。构建失败并显示

Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_CDEPersistentStoreEnsemble", referenced from:
__TMaCSo26CDEPersistentStoreEnsemble in AppDelegate.o
"_CDEMonitoredManagedObjectContextDidSaveNotification", referenced from:
__TFC8nicepal11AppDelegate11applicationfS0_FTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVSs10DictionaryCSo8NSObjectPSs9AnyObject____Sb in AppDelegate.o
"_OBJC_CLASS_$_CDEICloudFileSystem", referenced from:
__TMaCSo19CDEICloudFileSystem in AppDelegate.o
"_CDEICloudFileSystemDidDownloadFilesNotification", referenced from:
__TFC8nicepal11AppDelegate11applicationfS0_FTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVSs10DictionaryCSo8NSObjectPSs9AnyObject____Sb in AppDelegate.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我认为AppDelegate.swift中的相关代码是

var ensemble:CDEPersistentStoreEnsemble?
var ensembleCloudFileSystem:CDECloudFileSystem?
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, CDEPersistentStoreEnsembleDelegate {

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let store_url = self.applicationDocumentsDirectory.URLByAppendingPathComponent("nicepal.sqlite")
let modelURL = NSBundle.mainBundle().URLForResource("nicepal", withExtension: "momd")!

ensembleCloudFileSystem = CDEICloudFileSystem(
ubiquityContainerIdentifier: "something"
)

ensemble = CDEPersistentStoreEnsemble(
ensembleIdentifier: "IDENTIFIER",
persistentStoreURL: store_url,
managedObjectModelURL:modelURL,
cloudFileSystem:ensembleCloudFileSystem
)

ensemble?.delegate = self
NSNotificationCenter.defaultCenter().addObserver(self, selector: "syncWithCompletion:", name: CDEMonitoredManagedObjectContextDidSaveNotification, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector: "syncWithCompletion:", name: CDEICloudFileSystemDidDownloadFilesNotification, object: nil)
return true
}

我的错误可能就在眼前,但我不知道。

我的 Bridging-Header.h 看起来像

#import <Foundation/Foundation.h>
#import <Ensembles/Ensembles.h>
#import "DropboxSDK.h"
#import "CDEDropboxCloudFileSystem.h"

最佳答案

很可能您的桥接 header 未被读取。

Under Build Settings, make sure the Objective-C Bridging Header build setting under Swift Compiler - Code Generation has a path to the header. The path should be relative to your project, similar to the way your Info.plist path is specified in Build Settings. In most cases, you should not need to modify this setting.

根据您的设置,您可能还需要在 Swift 文件中导入框架。

import Ensembles

关于ios - iOS swift 尝试使用 Ensembles 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30691361/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com