Skip to content

Commit 32f0f24

Browse files
committed
Update SQLCipher Swift Package Manager dependencies to 4.16.0
- Update workspace Package.resolved to SQLCipher 4.16.0 - Update MobileSyncExplorerHybrid project to use SQLCipher 4.16.0 - Update AccountEditor project to use SQLCipher 4.16.0 - Update update-sqlcipher skill with SPM update instructions and troubleshooting Fixes package resolution conflict between iOS submodule (4.16.0) and sample apps (4.15.0).
1 parent d7ba1e8 commit 32f0f24

3 files changed

Lines changed: 121 additions & 8 deletions

File tree

.claude/skills/update-sqlcipher/SKILL.md

Lines changed: 119 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,66 @@ git add external/SalesforceMobileSDK-iOS
7171

7272
The submodule will now point to the iOS SDK commit with the SQLCipher update.
7373

74-
### 3. Verify Podspec Dependencies
74+
### 3. Update Swift Package Manager Dependencies
75+
76+
**CRITICAL:** The workspace and sample apps use Swift Package Manager for SQLCipher dependencies. These must be updated to match the iOS submodule version.
77+
78+
#### 3.1. Update Workspace Package.resolved
79+
80+
Update `SalesforceMobileSDK-Hybrid.xcworkspace/xcshareddata/swiftpm/Package.resolved`:
81+
82+
```json
83+
{
84+
"identity" : "sqlcipher.swift",
85+
"kind" : "remoteSourceControl",
86+
"location" : "https://github.com/sqlcipher/SQLCipher.swift",
87+
"state" : {
88+
"revision" : "<COMMIT_HASH>", // Get from SQLCipher tag
89+
"version" : "4.16.0" // Update to new version
90+
}
91+
}
92+
```
93+
94+
**To find the correct commit hash:**
95+
```bash
96+
git clone --depth=1 --branch 4.16.0 https://github.com/sqlcipher/SQLCipher.swift /tmp/sqlcipher-check
97+
cd /tmp/sqlcipher-check
98+
git log -1 --format="%H"
99+
```
100+
101+
#### 3.2. Update Sample App Project Files
102+
103+
Both sample apps have direct SQLCipher package references that must be updated:
104+
105+
**MobileSyncExplorerHybrid:**
106+
Edit `hybrid/SampleApps/MobileSyncExplorerHybrid/MobileSyncExplorerHybrid.xcodeproj/project.pbxproj`:
107+
108+
Find the section `XCRemoteSwiftPackageReference "SQLCipher"` and update:
109+
```
110+
requirement = {
111+
kind = exactVersion;
112+
version = 4.16.0; // Update from 4.15.0
113+
};
114+
```
115+
116+
**AccountEditor:**
117+
Edit `hybrid/SampleApps/AccountEditor/AccountEditor.xcodeproj/project.pbxproj`:
118+
119+
Find the section `XCRemoteSwiftPackageReference "SQLCipher"` and update:
120+
```
121+
requirement = {
122+
kind = exactVersion;
123+
version = 4.16.0; // Update from 4.15.0
124+
};
125+
```
126+
127+
**Why this is needed:** The sample apps declare exact SQLCipher versions in their project files. If these don't match the iOS submodule's version, Xcode's package resolution will fail with:
128+
```
129+
Could not resolve package dependencies:
130+
Failed to resolve dependencies Dependencies could not be resolved because root depends on 'sqlcipher.swift' 4.16.0 and root depends on 'sqlcipher.swift' 4.15.0.
131+
```
132+
133+
### 4. Verify Podspec Dependencies
75134

76135
Check `SalesforceHybridSDK.podspec`:
77136

@@ -87,7 +146,7 @@ The hybrid SDK depends on `MobileSync` from the iOS SDK, which transitively depe
87146

88147
**Important:** The iOS SDK's podspec (SmartStore.podspec) should already have the updated SQLCipher dependency. The hybrid SDK inherits it.
89148

90-
### 4. Build the Hybrid SDK
149+
### 5. Build the Hybrid SDK
91150

92151
Build the SalesforceHybridSDK library to catch compilation issues:
93152

@@ -104,7 +163,7 @@ Address any compilation errors related to:
104163
- API changes in MobileSync or SmartStore
105164
- Cordova plugin compatibility
106165

107-
### 5. Run Hybrid SDK Tests
166+
### 6. Run Hybrid SDK Tests
108167

109168
**CRITICAL**: Full SalesforceHybridSDK test suite must pass before proceeding.
110169

@@ -132,7 +191,7 @@ If tests fail:
132191
- Review Cordova plugin implementations in `libs/SalesforceHybridSDK/SalesforceHybridSDK/Classes/Plugins/`
133192
- Compare behavior with the iOS SDK's SmartStore tests
134193

135-
### 6. Verify Sample Apps
194+
### 7. Verify Sample Apps
136195

137196
Test the hybrid sample applications:
138197

@@ -156,14 +215,14 @@ Run the sample apps on a simulator to ensure:
156215
- SmartStore operations function correctly
157216
- MobileSync operations function correctly
158217

159-
### 7. Check Cross-Platform Consistency
218+
### 8. Check Cross-Platform Consistency
160219

161220
Since this is a hybrid SDK:
162221
- Verify the Android hybrid SDK has the corresponding SQLCipher update
163222
- Check the Shared repo for any JavaScript changes needed
164223
- Ensure CordovaPlugin repo is aware of the update (will need `tools/update.sh` run)
165224

166-
### 8. Create Pull Request
225+
### 9. Create Pull Request
167226

168227
When creating the PR:
169228
- **Branch name:** `sqlcipher-4.16` (or appropriate version)
@@ -180,6 +239,9 @@ When creating the PR:
180239
## File Checklist
181240

182241
- [ ] `external/SalesforceMobileSDK-iOS` - Update submodule reference
242+
- [ ] `SalesforceMobileSDK-Hybrid.xcworkspace/xcshareddata/swiftpm/Package.resolved` - Update SQLCipher version and commit hash
243+
- [ ] `hybrid/SampleApps/MobileSyncExplorerHybrid/MobileSyncExplorerHybrid.xcodeproj/project.pbxproj` - Update SQLCipher package version
244+
- [ ] `hybrid/SampleApps/AccountEditor/AccountEditor.xcodeproj/project.pbxproj` - Update SQLCipher package version
183245
- [ ] `SalesforceHybridSDK.podspec` - Verify dependencies (usually no change needed)
184246
- [ ] Run full SalesforceHybridSDK test suite
185247
- [ ] Build and test AccountEditor sample app
@@ -210,12 +272,63 @@ When creating the PR:
210272
- `hybrid/SampleApps/AccountEditor/` - Basic CRUD sample
211273
- `hybrid/SampleApps/MobileSyncExplorerHybrid/` - Complete sync demo
212274

275+
## Troubleshooting
276+
277+
### Package Resolution Failures
278+
279+
**Error:**
280+
```
281+
xcodebuild: error: Could not resolve package dependencies:
282+
Failed to resolve dependencies Dependencies could not be resolved because root depends on 'sqlcipher.swift' 4.16.0 and root depends on 'sqlcipher.swift' 4.15.0.
283+
```
284+
285+
**Cause:** Version mismatch between:
286+
- iOS submodule's SQLCipher dependency (in SmartStore.podspec)
287+
- Workspace Package.resolved
288+
- Sample app project files
289+
290+
**Solution:**
291+
1. Check iOS submodule version: `grep -A 5 "SQLCipher" external/SalesforceMobileSDK-iOS/SmartStore.podspec`
292+
2. Update workspace Package.resolved to match
293+
3. Update both sample app project.pbxproj files to match
294+
4. Clean build folder: `rm -rf ~/Library/Developer/Xcode/DerivedData/*`
295+
296+
### Wrong Commit Hash in Package.resolved
297+
298+
**Error:**
299+
```
300+
Couldn't check out revision 'xxxxx':
301+
fatal: unable to read tree (xxxxx)
302+
```
303+
304+
**Cause:** Incorrect commit hash in Package.resolved
305+
306+
**Solution:**
307+
```bash
308+
git clone --depth=1 --branch 4.16.0 https://github.com/sqlcipher/SQLCipher.swift /tmp/sqlcipher-check
309+
cd /tmp/sqlcipher-check
310+
git log -1 --format="%H"
311+
# Use this hash in Package.resolved
312+
```
313+
314+
### Sample Apps Won't Build After Update
315+
316+
**Cause:** Sample app project files still reference old SQLCipher version
317+
318+
**Solution:**
319+
Search for old version in project files:
320+
```bash
321+
grep -r "4.15.0" hybrid/SampleApps/*/*/project.pbxproj
322+
```
323+
Update all occurrences to new version.
324+
213325
## Notes
214326

215327
- The iOS Hybrid SDK doesn't directly manage SQLCipher dependencies
216328
- SQLCipher updates flow through the iOS SDK submodule
217329
- Always update the iOS SDK first, then update the submodule reference
218330
- The hybrid SDK's dependency on MobileSync brings in SmartStore and SQLCipher transitively
331+
- **Swift Package Manager is used by the workspace and sample apps** - these must be updated separately from podspecs
219332
- Hybrid plugins (SFSmartStorePlugin, SFMobileSyncPlugin) bridge JavaScript to the native iOS SDK
220333
- Test with encrypted databases from previous versions to ensure migration works
221334
- After updating, the CordovaPlugin repo will need to run `tools/update.sh` to sync changes

hybrid/SampleApps/AccountEditor/AccountEditor.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1343,7 +1343,7 @@
13431343
repositoryURL = "https://github.com/sqlcipher/SQLCipher.swift";
13441344
requirement = {
13451345
kind = exactVersion;
1346-
version = 4.15.0;
1346+
version = 4.16.0;
13471347
};
13481348
};
13491349
/* End XCRemoteSwiftPackageReference section */

hybrid/SampleApps/MobileSyncExplorerHybrid/MobileSyncExplorerHybrid.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1343,7 +1343,7 @@
13431343
repositoryURL = "https://github.com/sqlcipher/SQLCipher.swift";
13441344
requirement = {
13451345
kind = exactVersion;
1346-
version = 4.15.0;
1346+
version = 4.16.0;
13471347
};
13481348
};
13491349
693387C62E83320100F667A7 /* XCRemoteSwiftPackageReference "fmdb" */ = {

0 commit comments

Comments
 (0)