我宣布RealmSwift类后我的应用程序崩溃了

时间:2015-05-16 22:12:15

标签: ios swift realm

我宣布了课程

function Person(name, age) {
  this.name = name || "de-name";
  this.age = !!Number(age) ? Number(age) : 0;
}

Person.prototype.setName = function(name) {
  this.name = name;
  return this;
}

function Student(name) {
  Person.call(this, name); // Copy instance properties of Person class
  this.title = "Student";
}

// Suggested way
Student.prototype = Object.create(Person.prototype);


// Possible approach-1
// Student.prototype = Person.prototype;   

// Possible approach-2
// Student.prototype = new Person();

当我运行我的应用程序时,控制台日志:

  

dyld:未加载库:@ rpath / RealmSwift.framework / RealmSwift     参考自:/Users/macbook/Library/Developer/CoreSimulator/Devices/EA7EDDF8-C23C-494A-B702-2AC0F0484F54/data/Containers/Bundle/Application/1E43EC69-375D-4F14-A90D-86AF9728E260/SearchFilm.app/SearchFilm     原因:找不到图像   (lldb)

1 个答案:

答案 0 :(得分:3)

Realm曾经包含一个strip-frameworks.sh,需要在项目中添加为构建脚本。

build script

下的项目属性编辑器中将其添加为Build Phases
bash ${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/RealmSwift.framework/strip-frameworks.sh

注意:我正在使用Swift-2.0库,并且不包含此文件。当我解决Swift2.0的问题时,我会更新我的答案

修改

我最终让它在Swift 2.0中运行

我关注了所有the instructions here,然后将两个框架添加到Embedded Binaries,如下所示:

embedded binaries section