Skip to content

Commit 3b58f3a

Browse files
authored
fix: ios crash on corrupted storage (#34)
1 parent 6a9794d commit 3b58f3a

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

.github/workflows/ios-test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535

3636
- uses: futureware-tech/simulator-action@v3
3737
with:
38-
model: 'iPhone 15'
38+
model: 'iPhone 16'
3939

4040
- name: Set up Flutter
4141
uses: subosito/flutter-action@v2

ios/Classes/ConfidenceFlutterSdkPlugin.swift

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,13 @@ public class ConfidenceFlutterSdkPlugin: NSObject, FlutterPlugin {
5757
result("")
5858
return
5959
}
60-
try! await confidence.fetchAndActivate()
60+
do {
61+
try await confidence.fetchAndActivate()
62+
} catch {
63+
NSLog("%@", "Confidence SDK: \(error)")
64+
}
6165
result("")
66+
return
6267
}
6368
break;
6469
case "activateAndFetchAsync":
@@ -67,9 +72,13 @@ public class ConfidenceFlutterSdkPlugin: NSObject, FlutterPlugin {
6772
result("")
6873
return
6974
}
70-
try! confidence.activate()
75+
do {
76+
try confidence.activate()
77+
} catch {
78+
NSLog("%@", "Confidence SDK: \(error)")
79+
}
7180
Task {
72-
await confidence.asyncFetch()
81+
confidence.asyncFetch()
7382
}
7483
result("")
7584
}

0 commit comments

Comments
 (0)