realm

Realm thread safe object with singleton

让人想犯罪 __ 提交于 2019-12-02 02:45:00
So I have a singleton class that manages the current user that is logged into my application. It looks like this class SessionManager { static let shared = SessionManager() var loggedInUser: User? } The problem is that if I want to get that user object from a background thread, I can't as I get the following exception: 'RLMException', reason: 'Realm accessed from incorrect thread.' After some googling I found Thread Safe Reference's. So I changed my class to be something like this instead: class SessionManager { static let shared = SessionManager() private var threadSafeUser:

springboot shiro 基本整合

无人久伴 提交于 2019-12-02 02:41:30
springboot shiro 基本整合 https://www.w3cschool.cn/shiro/c52r1iff.html http://shiro.apache.org/configuration.html#Configuration-ProgrammaticConfiguration 步骤 依赖和配置 定义 org.apache.shiro.realm.Realm 使用 IniRealm 定义 org.apache.shiro.mgt.SecurityManager 定义 org.apache.shiro.spring.web.ShiroFilterFactoryBean 指定登录页面 shiroFilterFactoryBean.setLoginUrl("/login.html") 放行登录相关接口和静态资源 定义登录Controller Map<String, String> map = new HashMap<>(); map.put("/login/pc", "anon"); shiroFilterFactoryBean.setFilterChainDefinitionMap(map); 依赖 <dependency> <groupId>org.apache.shiro</groupId> <artifactId>shiro-spring<

NSDiacriticInsensitivePredicateOption not supported by Realm

点点圈 提交于 2019-12-02 01:30:53
问题 I have DictObject with a text property that contains some Vietnamese letters, such as "Sống". @interface DictObj : RLMObject @property NSString *text;//Ex: sống @end I would like to use BEGINSWITH[cd] to perform a diacritic insensitive search, but Realm does not currently support it: RLMResults *fetchedResults = [DictObj objectsInRealm:realm where:@"text BEGINSWITH[cd] %@",inputText]; I can use kCFStringTransformStripDiacritics to transform my input text, but I don't know how to perform that

Cannot read property 'debugHosts' of undefined

谁说我不能喝 提交于 2019-12-02 01:24:59
I'm getting this error while trying to use Realm with RN 0.29 Stack trace from chrome: "Cannot read property 'debugHosts' of undefined" handleException @ ExceptionsManager.js:55 handleError @ InitializeJavaScriptAppEngine.js:136 reportFatalError @ error-guard.js:30 guardedLoadModule @ require.js:60 _require @ require.js:49 (anonymous function) @ require-0.js:1 executeApplicationScript @ debuggerWorker.js:18 onmessage @ debuggerWorker.js:33 The device is pointing to the index.js file in the node_modules/realm/lib/index.js in this line: const {debugHosts, debugPort} = NativeModules.Realm; One

Realm not auto-deleting database if migration needed

南楼画角 提交于 2019-12-02 00:23:58
We are in development and db schema changes occur often. Since we are not live, migrations are not needed. I therefor configured Realm as follows: RealmConfiguration config = new RealmConfiguration.Builder(context) .name("jt.realm") .schemaVersion(1) .deleteRealmIfMigrationNeeded() // todo remove for production .build(); Realm.setDefaultConfiguration(config); However, when the schema is changed, an exception is thrown: RealmMigration must be provided My understanding from the docs are that the Realm should auto-delete the db since deleteRealmIfMigrationNeeded() is present in the config, but

dyld: Symbol not found: __TMPdCSs12AnyGenerator

点点圈 提交于 2019-12-02 00:18:14
when I try to build and Run my project it gives me an error of symbol not found: __TMPdCSs12AnyGenerator I had installed Xcode 7 beta on my system. When I installed it gives me an error of realm module not found so I just removed realm framework and added again after adding this frameworks again it gives about stated error. I have encountered this problem after I update my XCode from 7.2 to 7.3. I use a framework build from XCode7.2. After I rebuild the framework on XCode7.3, the problem was solved. You need to add Realm.framework and RealmSwift.framework to the “Embedded Binaries” section of

Saving realm relationships does not persist them

老子叫甜甜 提交于 2019-12-01 23:26:40
I have a list of articles . Those articles are inserted by using realm.copyToRealmOrUpdate(); which works perfectly fine. Now each article has an authorId which should not be persisted. Rather I want to find the stored author RealmObject and set its relationship for the article. Author author = realm.where(Author.class).equalTo("id", article.getSerializedAuthor()).findFirst(); article.setAuthor(author); Somehow this does not seem to be persisted by realm. The same applies to the image RealmObject , just that I iterate before saving. Here's the full snippet. realm.beginTransaction(); realm

Realm - module file was created by an older version of compiler

拜拜、爱过 提交于 2019-12-01 21:58:57
I use latest version of xcode and swift 2.2. One of my projects, which I havent open for several month now not building, because of error module file was created by an older version of compiler I tried the following Removed realm frameworks from project, then download the latest version from realm.io and copy the new frameworks to project Building realm by build.sh build from github sources with REALM_SWIFT_VERSION=2.2 and adding to project Neither of these helped, still got error. Any advices ? Can you try the following? Delete derived data Clean the build folder (click on Xcode's Product

Getter is not associated to any field

江枫思渺然 提交于 2019-12-01 21:56:06
问题 I am getting a compiler error " Getter getLength_inch is not associated to any field " for the following code. getLength_inch is just a utility method... import io.realm.RealmObject; public class Measurement extends RealmObject { private float length_mm; public void setLength_mm(float c){length_mm = c;} public float getLength_mm() { return length_mm;} public float getLength_inch() { return length_mm * 0.0394f;} } It seems that any descendant of RealmObject cannot implement anything else than

Enqueued from com.apple.main-thread (Thread 1) Crash | iOS | Swift 4.1

社会主义新天地 提交于 2019-12-01 21:35:34
问题 What's happening above: Initialize realm model from the received array of user data. Write all the models at once in the realm DB in the background thread. Realm model is getting updated if they already exist by creating a copy. Can anyone please guide me here about what I am doing wrong. 来源: https://stackoverflow.com/questions/55700998/enqueued-from-com-apple-main-thread-thread-1-crash-ios-swift-4-1