Comments (9)
A similar crash report can be found here #5618 where the issue appears to be caused by FirebasePerformance. There are several workarounds suggested there, notably rather than rely on automatic schema discovery, you can explicitly specify the objectClasses
field in your configuration.
I'll close the issue due to lack of information, but if you do come back to it and keep seeing it after trying the suggested workarounds, feel free to reopen.
from realm-swift.
It works!!
from realm-swift.
Can you please provide a minimal but complete coding sample that replicates the crash?
from realm-swift.
// MARK: - Property
#if DEBUG
private static let realmName = "localDB.realm"
#else
private static let realmName = "defaultDB.realm"
#endif
// MARK: - Init Func
func initDefaultConfig() {
guard let documentsURL = FileManager.default.urls(
for: .documentDirectory,
in: .userDomainMask
).first else {
return
}
let dbPath = documentsURL.appendingPathComponent(realmName)
let config = Realm.Configuration(
fileURL: dbPath,
schemaVersion: 3
) { migration, oldSchemaVersion in
if oldSchemaVersion < 2 {
migration.enumerateObjects(ofType: VSTempHumiRecord.className()) { oldObject, newObject in
newObject?.inTemp = oldObject?.inTemp
newObject?.outTemp = oldObject?.outTemp
newObject?.inHumi = oldObject?.inHumi
newObject?.outHumi = oldObject?.outHumi
if oldObject?.isSynced == nil {
newObject?.isSynced = false
}
}
}
if oldSchemaVersion < 3 {
migration.enumerateObjects(ofType: VSTempHumiRecord.className()) { oldObject, newObject in
newObject?.bTemp = oldObject?.inTemp
newObject?.bHumi = oldObject?.inHumi
newObject?.pTemp = oldObject?.outTemp
newObject?.pHumi = oldObject?.outHumi
}
}
}
Realm.Configuration.defaultConfiguration = config
Realm.asyncOpen { result in
switch result {
case .success(let realm):
print(self, realm)
case .failure(let error):
print(self, error)
}
}
}
from realm-swift.
public class VSTempHumiRecord: Object {
@Persisted(primaryKey: true) var unionPrimaryKey: String = ""
@Persisted var showDate: Date?
@Persisted var cFanlv: Int?
@Persisted var dFanlv: Int?
@Persisted var lightlv: Int?
@Persisted var inHumi: Int? = 0
@Persisted var inTemp: Int? = 0
@Persisted var outHumi: Int? = 0
@Persisted var outTemp: Int? = 0
@Persisted var bHumi: Int?
@Persisted var bTemp: Int?
@Persisted var pHumi: Int?
@Persisted var pTemp: Int?
@Persisted var time = 0
@Persisted var deviceId = ""
@Persisted var isSynced = false
}
from realm-swift.
I have tried to copy your code in a brand new project, ran it, and didn't get any crashes. You can find the project I used attached to this comment. If you're able to modify the project I supplied or provide us with a project that actually reproduces the problem, we'll be able to continue the investigation.
from realm-swift.
It may be that in the demo there is no historical data so there will be no time-consuming operation.
However, in the specific project( on-line release version), our firebase crashlytics in general prompts are triggered within 1-2s of app startup.
So I would like to ask the crash caused by initialization migration operation initDefaultConfig
written in appdelegate. didFinshLaunching
?
from realm-swift.
When you add a breakpoint to your code, and then run the project and step through it line by line, what line is crashing? Which variables are not as expected?
from realm-swift.
@GengJian it may very well be the historical data on the device, but unless we're able to repro the crash or get more information about it, there's not much we can do. My point was that I tried to repro with the code you provided and things work correctly for me. If you're able to give us more details or a repro case we can run locally, then I'd be happy to continue investigating.
from realm-swift.
Related Issues (20)
- Devise public API to trigger client reset for a Realm file
- baseUrl Change
- Crash in app launch ios 14 and earlier HOT 4
- @AutoOpen doesn't work HOT 1
- Crash when launch HOT 9
- Crash with in query when comparing with empty collection
- Sectioned Results with Empty Sections HOT 5
- Realm-swift is utilising 100-150% CPU when in background HOT 3
- Crashed: Realm Notification Listener (BACKGROUND) HOT 9
- Error InvalidSession on logout after delete user HOT 7
- Crash - Assertion failed: m_lock_info && m_lock_info->m_file.get_path() == m_filename HOT 5
- Crash in Realm Sync, realm::SyncSession::handle_location_update_failed, realm_core_v_13_26_0 HOT 11
- Building with cocoapods produces warning about duplicate libraries - "-lc++" HOT 1
- realm-monorepo.xcframework & required reason API usage HOT 2
- Update default base URL to new domain HOT 1
- Possible perf regression between 10.42.3 and 10.47.0 HOT 6
- "Decryption failed" errors immediately after compacting two Realm files on startup HOT 6
- Create a GHA workflow to upload core prebuilds to S3 HOT 1
- Swift UI Previews are crashing in Xcode 15.3 (worked fine in 15.2). HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from realm-swift.