小编Riy*_*sen的帖子

对象不是此Realm的架构的一部分

一旦我尝试从Realm数据库中获取对象,应用程序崩溃了,我收到此错误:

java.lang.RuntimeException: Unable to start activity 
      ComponentInfo{com.repdev.realtimedelijn/com.repdev.realtimedelijn.activity.MainActivity}: 
    java.lang.IllegalArgumentException: Haltes is not part of the schema for this Realm
Run Code Online (Sandbox Code Playgroud)

这是我的活动它发生了

   @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Fabric.with(this, new Crashlytics());
    setContentView(R.layout.activity_main);
    Context context = this;
    View view = this.getWindow().getDecorView();

    realm = Realm.getInstance(getRealmConfiguration());
    RealmResults<Haltes> haltes = realm
            .where(Haltes.class)
            .findAll();
    HaltesRecyclerViewAdapter haltesRecyclerViewAdapter =
            new HaltesRecyclerViewAdapter(this, haltes, true, true);
    RealmRecyclerView realmRecyclerView =
            (RealmRecyclerView) findViewById(R.id.realm_recycler_view);
    realmRecyclerView.setAdapter(haltesRecyclerViewAdapter);
}
Run Code Online (Sandbox Code Playgroud)

这是模型

有人知道如何解决它?公共类Haltes实现RealmModel {

@PrimaryKey
private long id;

private String halteNaam;
private String halteNummer;

public long getId() {

    return …
Run Code Online (Sandbox Code Playgroud)

java android realm

14
推荐指数
3
解决办法
9984
查看次数

iOS如何知道哪个按钮按下了CollectionView与自定义委托

所以我在一个集合视图中有一个单元格,里面有3个按钮.为了使用这些按钮触发代码,我实现了一个自定义委托.现在代码被触发,但我不知道代码触发了哪个单元格.我怎样才能最好地实现这一点?这是我的一些代码.协议:

protocol OverViewDelegate {
func registerButtonClicked()
func evaluateButtonClicked()
func overviewButtonClicked()
}
Run Code Online (Sandbox Code Playgroud)

cellForItemAt:

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
    let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "sessionCell", for: indexPath) as? SessionCollectionViewCell
    let session: SessionModel
    session = DebugData.shared.sessionArray[indexPath.row]

    cell?.sessionImage.image = #imageLiteral(resourceName: "carControl")
    cell?.sessionNameLabel.text = session.name
    cell?.sessionLocationLabel.text = session.location
    cell?.overViewDelegate = self

    return cell!
}
Run Code Online (Sandbox Code Playgroud)

细胞:

import UIKit
Run Code Online (Sandbox Code Playgroud)

导入IBAnimatable

@IBOutlet weak var sessionImage: UIImageView!
@IBOutlet weak var sessionNameLabel: UILabel!
@IBOutlet weak var sessionLocationLabel: UILabel!
@IBOutlet weak var sessionRegisterButton: AnimatableButton!
@IBOutlet weak var …
Run Code Online (Sandbox Code Playgroud)

delegates ios uicollectionviewcell swift

3
推荐指数
1
解决办法
1149
查看次数

标签 统计

android ×1

delegates ×1

ios ×1

java ×1

realm ×1

swift ×1

uicollectionviewcell ×1