realm

SWIFT - Realm db encryption not working

时光怂恿深爱的人放手 提交于 2019-12-01 01:19:23
Im trying to encrypt the data stored in the realm database. I followed the Sample Code mentioned on Realm's Swift page . I want to encrypt the data NOT the database file. Below is the code I'm using: var error: NSError? = nil let configuration = Realm.Configuration(encryptionKey: EncryptionManager().getKey()) if let realmE = Realm(configuration: configuration, error: &error) { // Add an object realmE.write { realmE.add(objects, update: T.primaryKey() != nil) } } Where objects is a list of objects i need to insert in the database. Below is the code fore getKey() func also picked from the sample

RLMObject with Array of NSStrings

自闭症网瘾萝莉.ら 提交于 2019-12-01 01:05:59
问题 I've been upgrading a project to use Realm as the persistence store and I'm not able to find any documentation on how to use an array of strings in one of my models. The implementation of an Array for a RLMObject is to use an RLMArray where T inherits RLMObject I could make an object that inherits.. property inside which is string... but that seems like quite some overhead to replace an NSArray of strings. Does anyone know the recommended best practice to do this? 回答1: As of Realm Cocoa 3.0

How does the size of a realm-file develop?

杀马特。学长 韩版系。学妹 提交于 2019-12-01 01:03:11
How does the size of a realm-file develop ? To start with: I have a realm-file with several properties and one of them being an array of 860 entries and each array-entry consists of a couple of properties again. One array-property states the name of the entry. I observed the following: If the name-property sais "Criteria_A1" (until "Criteria_A860") - then the realm-file is 1.6 MB big If the name-property sais "A1" (until "A860") - then the realm-file is only 786 kB big Why is the extra letters in the array-name-property making the realm-file this much bigger ?? A second observation: if I add

Does Realm models actually require getters and setters?

放肆的年华 提交于 2019-12-01 00:30:22
问题 I cannot find it clearly documented anywhere if getters and setters are actually required for fields in a Realm Model. For example, the documentation at https://realm.io/docs/java/latest/api/io/realm/RealmObject.html says The only restriction a RealmObject has is that fields are not allowed to be final, transient' or volatile. Any method as well as public fields are allowed. When providing custom constructors, a public constructor with no arguments must be declared and be empty. Fields

Detect a realm authentication failure reason in Tomcat

风格不统一 提交于 2019-12-01 00:06:29
I wrote a custom Realm for Tomcat 7. I wrap it in the lockout Realm provided by the default installation of Tomcat. The lockout feature works fine, but in my web.xml, I have <error-page> <error-code>403</error-code> <location>/forbidden.html</location> </error-page> which will direct any users that do not authenticate to the page. However, it also redirects correctly authenticated users to the page if they are locked out. Is there someway I can detect the difference when a user incorrectly authenticates and is locked out? It does not look easy. My first idea was subclassing the LockOutRealm

What's wrong with my #if TARGET_OS_SIMULATOR code for Realm path definition?

我怕爱的太早我们不能终老 提交于 2019-11-30 23:15:24
问题 I have this code #if TARGET_OS_SIMULATOR let device = false let RealmDB = try! Realm(path: "/Users/Admin/Desktop/realm/Realm.realm") #else let device = true let RealmDB = try! Realm() #endif device bool works fine, yet RealmDB works only for else condition. 回答1: TARGET_IPHONE_SIMULATOR macro doesn't work in Swift. What you want to do is like the following, right? #if arch(i386) || arch(x86_64) let device = false let RealmDB = try! Realm(path: "/Users/Admin/Desktop/realm/Realm.realm") #else

Android studio: UnsatisfiedLinkError: findLibrary returned null - loading native library

蹲街弑〆低调 提交于 2019-11-30 23:05:26
问题 I am making an app in Android Studio which uses two libraries. A native library with an Android wrapper and a jar-library. For some reason, the native library won't load if the other jar-library is compiled into the project. So if I run the app with only the native library, everything works fine. I add the other jar-library to my gradle-file and boom... an UnsatisfiedLinkError: java.lang.UnsatisfiedLinkError: Couldn't load MobileOcrEngine from loader dalvik.system.PathClassLoader[DexPathList[

How to convert RealmResults<Object> to List<Object>

允我心安 提交于 2019-11-30 22:26:39
问题 I have RealmResults that I receive from Realm like RealmResults<StepEntry> stepEntryResults = realm.where(StepEntry.class).findAll(); Now I want convert RealmResults<StepEntry> to ArrayList<StepEntry> I have try ArrayList<StepEntry> stepEntryArray = new ArrayList<StepEntry>(stepEntryResults)); but the item in my ArrayList is not my StepEntry object, it is StepEntryRealmProxy How can I convert it? Any help or suggestion would be great appreciated. 回答1: To eagerly read every element from the

Realm - Can't use object after having been deleted

三世轮回 提交于 2019-11-30 22:02:10
I have a video player in my app. There is a list of videos in a collection view. If you tap on one of the cells, a new view controller appears to play the selected video. Also, you can cycle through all of the videos from the collection view in this new view controller because the entire list is passed. The problem is: When the user is in the PlayerVC , they can unfavorite a Video . If they do this, I delete the Video object from Realm. However, this causes a: Terminating app due to uncaught exception 'RLMException', reason: 'Object has been deleted or invalidated.' Basically, if a user is

List<Object> Or RealmList<RealmObject> on Realm Android

旧时模样 提交于 2019-11-30 21:57:09
问题 I need a list<Object> using Realm. I tried RealmList<RealmObject> but it doesn't work because RealmObject is abstract. 回答1: Christian from Realm here. You can only save objects that extend RealmObject inside a Realm. This is because Realm is not a schemaless database. We do require a schema and that schema is defined by your objects that extend RealmObject. We use RealmList because it abstracts away the communication with the underlying core database, but it implements the List interface.