realm

Add array of json (which contain inner array) in realm using swift

拟墨画扇 提交于 2019-12-11 06:07:08
问题 I have created API which generate JSON, that JSON looks like this [ { "id": 105, "date": "2018-09-06T22:37:57", "date_gmt": "2018-09-06T17:07:57", "guid": { "rendered": "http://wh2.6ae.myftpupload.com/?p=105" }, "modified": "2018-09-06T22:37:57", "modified_gmt": "2018-09-06T17:07:57", "slug": "video-post-20", "status": "publish", "type": "post", "link": "http://wh2.6ae.myftpupload.com/video-post-20/", "title": { "rendered": "Video post – 20" }, "content": { "rendered": "", "protected": false

converting NSArray to RLMArray with RKValueTransFormer fails converting outputValue to AutoreleasingUnsafeMutablePointer<AnyObject?>

五迷三道 提交于 2019-12-11 06:02:58
问题 I am using RestKit and realm.io together. I have an array of values (the array is url strings of pictures) being returned in JSON that should become a RLMArray of RLMObject s. I believe the mappings are set up correctly because it makes an attempt to convert the results to an RLMArray . But I get the following error from RestKit: restkit.object_mapping:RKMappingOperation.m:449 Failed transformation of value at keyPath 'picList' to representation of type 'RLMArray': Error Domain=org.restkit

Is realm stable enough for production use?

不羁岁月 提交于 2019-12-11 06:02:20
问题 After reading the documentation on the website, I was very impressed with how easy it is to implement and use. However, I also noticed that it hasn't been officially released yet and it is still in beta. I will soon start a new iOS project and I was wondering if realm is "stable" enough for production use. As many of you know, CoreData is a pain in the ___. Thanks, 回答1: According to the folks at realm, the framework has been used in production, however, developers should expect the API to

How to add enums to realm model? RLMObject?

守給你的承諾、 提交于 2019-12-11 05:15:32
问题 This is my serviceModel.h typedef NS_ENUM(NSInteger, OKServiceType) { OKServiceTypePending = 0, OKServiceTypeAccepted , OKServiceTypeStarted, OKServiceTypeCompleted, OKServiceTypeClosed, OKServiceTypeCancelled }; @interface serviceModel : RLMObject @property NSString *job_id; @property NSString *job_service_id; @property NSString *service_id; @property NSString *vendor_id; @property NSString *timeslot; @property NSString *points; @property OKServiceType *status; @property NSString *service

Updating realm object having primary key

大城市里の小女人 提交于 2019-12-11 05:02:20
问题 I am trying to update a realm object with primary key. Now keep in mind I am not updating the primary key but only another field in there. Below is my my Object : class UserData : Object { @objc dynamic var name: String? = nil @objc dynamic var bio: String? = nil @objc dynamic var username: String? = nil @objc dynamic var phone: String? = nil @objc dynamic var uid : String? = nil @objc dynamic var imageL: Data? = nil override static func primaryKey() -> String { return "uid" } } extension

Realm for Swift 3.1 - Command failed due to signal: Illegal instruction: 4

ⅰ亾dé卋堺 提交于 2019-12-11 04:49:53
问题 After updating Swift to v3.1, I got Realm frameworks replaced by the new version downloaded from Realm Swift 2.5.1 but get the following issue: Command failed due to signal: Illegal instruction: 4 Already checked this and this, but they didn't work. Here is the error description, not sure if it's helpful though. CompileSwift normal x86_64 /Users/linhcn/Documents/XcodeProjects/HerdManager/HerdManager/Models/ActionCategory.swift -target x86_64-apple-ios9.3 -enable-objc-interop -sdk

Low level android out of memory crashes using Realm

╄→尐↘猪︶ㄣ 提交于 2019-12-11 04:36:46
问题 I've been getting many OOM crashes in my android app (many but not all of them seem to be in Realm code: First: io.realm.exceptions.RealmError: Unrecoverable error. mmap() failed: Out of memory size: 872415232 offset: 0 in /Users/zaki/fromgit/realm/realm-java/realm/realm-library/src/main/cpp/io_realm_internal_SharedRealm.cpp line 92 Second: io.realm.exceptions.RealmError: Unrecoverable error. Too many open files in /Users/zaki/fromgit/realm/realm-java/realm/realm-library/src/main/cpp/io_realm

How to convert Realm object to JSON with nested NSDate properties?

偶尔善良 提交于 2019-12-11 04:09:43
问题 I have a nested Realm Object with multiple nested NSDate properties within the nested objects. I am using this answer to transform the nested Realm Object to an NSDictionary , but I do not know how to convert that NSDictionary to actual JSON. When I use NSJSONSerialization.dataWithJSONObject() , I get the error: 'Invalid type in JSON write (__NSTaggedDate)' From what I understand, I must first convert the NSDate properties to NSString . The problem is I don't know how to reach into the deeply

Automatically Reload TableViewController On Rewind

青春壹個敷衍的年華 提交于 2019-12-11 03:56:33
问题 I am working on an app where it starts out at a tableViewController which loads and displays data stored in a Realm database. I have it so I can create a new entry in my Realm database in a separate scene and the save button unwind segues back to the initial tableView. I current have it so the tableViewController will reload the tableView on pull down (something I Learned here, second answer down) but I would be better if the tableView would reload its self automatically upon unwind,

Realm not working after migration

风流意气都作罢 提交于 2019-12-11 03:50:00
问题 This is the relevant code in my UIViewController : class HabitTableViewController: UIViewController, UITableViewDataSource, UITableViewDelegate{ @IBOutlet weak var habitTableView: UITableView! private var _numOfRowsInSects: [Int] = [] private var _allSections = Set<Int>() //_[0] = 1 -> Morning private let _timeInDay = [0: "Morning", 1: "Afternoon", 2:"Evening", 3:"Anytime"] private var _habitsBySection:[[Habit]] = [] private var _whatIsToday = -1 //means no button other than today has been