简体   繁体   中英

Cannot access realm fetched data

I successfully fetch my Board data via

let boards: [Board] = try! db.fetch(FetchRequest<Board>())

After that i iterate over boards an make a

print(board)

wich outputs:

Board {
    id = 1;
    name = The Name;
    shortDescription = The Description;
    slug = the_name;
}

But when i want to access the board name directly with eg

 board.name

the following Error is thrown:

fatal error: unexpectedly found nil while unwrapping an Optional value

What´s my mistake? If board is not an Object, how i can achieve that it will be one?

I´m using:

SugarRecord
ObjectMapper 
RealmSwift
ObjectMapper_Realm

Through the missing Documentation in ObjectMapper_Realm i didn´t had the

 dynamic

keyword in front of my var declaration.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM