Skip to content

Commit 8abc9cf

Browse files
committed
ci: switch to macos-14 + Xcode 15.4, add troubleshooting docs
macOS-15 + Xcode 16.2 fails with "iOS 18.2 Platform Not Installed" on storyboard compilation (same issue as Cordova iOS builds). Also add TROUBLESHOOTING.md (for users) and CONTRIBUTING.md (for contributors) documenting iOS build requirements and known issues.
1 parent 3c81fd7 commit 8abc9cf

3 files changed

Lines changed: 105 additions & 3 deletions

File tree

.github/workflows/build-capacitor-ios.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ on:
88

99
jobs:
1010
build:
11-
runs-on: macos-15
11+
runs-on: macos-14
1212
strategy:
1313
fail-fast: false
1414
matrix:
1515
include:
1616
- capacitor-version: '6'
17-
xcode-version: '16.2'
17+
xcode-version: '15.4'
1818
- capacitor-version: '7'
19-
xcode-version: '16.2'
19+
xcode-version: '15.4'
2020
steps:
2121
- uses: actions/checkout@v4
2222

capacitor/CONTRIBUTING.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Contributing
2+
3+
## Podspec naming convention
4+
5+
Capacitor CLI derives the CocoaPods pod name from the npm package name:
6+
7+
```
8+
npm: capacitor-plugin-cdv-purchase → pod: CapacitorPluginCdvPurchase
9+
```
10+
11+
The podspec filename and `s.name` must match this derived name exactly. A mismatch causes "No podspec found" during `pod install`.
12+
13+
There are two podspecs:
14+
- `CapacitorPluginCdvPurchase.podspec` — root-level, used by Capacitor CLI (paths relative to package root)
15+
- `ios/CapacitorPluginPurchase.podspec` — legacy (paths relative to `ios/`)
16+
17+
## iOS availability guards
18+
19+
The plugin targets iOS 15.0 but some APIs require newer versions:
20+
21+
- `AppTransaction.shared` — requires `#available(iOS 16.0, *)`
22+
- `AppStore.presentOfferCodeRedeemSheet` — requires `#available(iOS 16.0, *)`
23+
- `Locale.region` — requires `#available(iOS 16.0, *)`
24+
25+
Always wrap these in availability checks with a fallback.
26+
27+
## SPM (Swift Package Manager) compatibility
28+
29+
The plugin builds with CocoaPods. SPM support is provided via `Package.swift` but has known limitations with Capacitor's precompiled xcframework.
30+
31+
### The problem
32+
33+
Capacitor distributes its iOS framework as a precompiled `.xcframework` via `capacitor-swift-pm`. Swift extension methods on Objective-C types are not exported from binary frameworks. This means common Capacitor APIs are invisible when built via SPM:
34+
35+
| API | SPM status | Workaround |
36+
|-----|-----------|------------|
37+
| `call.resolve()` | Works | (zero-arg overload) |
38+
| `call.resolve(data)` | Works | |
39+
| `call.reject(msg)` | Not available | None reliable — method is invisible |
40+
| `call.getString("key")` | Not available | `call.options["key"] as? String` |
41+
| `call.getArray("key")` | Not available | `call.options["key"] as? [Type]` |
42+
| `call.getBool("key")` | Not available | `call.getBool("key", false)` |
43+
| `CAPPluginCallError(...)` | Not available | Init is inaccessible |
44+
45+
### Impact
46+
47+
This is a Capacitor-level issue affecting **all** third-party plugins, not specific to this one. It needs to be resolved upstream in `ionic-team/capacitor` by either shipping source via SPM instead of precompiled binaries, or moving APIs to ObjC headers. SPM became the default in Capacitor 8.
48+
49+
### CI strategy
50+
51+
The CI tests against Capacitor 6 and 7 using CocoaPods (the default for those versions). Once the upstream SPM issue is resolved, Capacitor 8 can be added to the test matrix.
52+
53+
## CI environment notes
54+
55+
- **macOS-15 + Xcode 16.2** may report "no destinations" with `-sdk iphoneos`. Use `-destination 'generic/platform=iOS'` instead.
56+
- **`@capacitor/create-app`** always scaffolds the latest template (Cap 8 / SPM) regardless of CLI version. For testing older versions, scaffold manually with `npm init` + pinned deps.
57+
- **Ruby version conflicts** on macOS: `pod` (Homebrew) and `gem` (system) may point to different Ruby versions. Install gems with the Homebrew Ruby if needed.

capacitor/TROUBLESHOOTING.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Troubleshooting
2+
3+
## iOS requires minimum deployment target 15.0
4+
5+
This plugin uses **StoreKit 2**, which requires **iOS 15.0**. Capacitor 6 and 7 generate Podfiles with a lower default. Open `ios/App/Podfile` and update:
6+
7+
```ruby
8+
# Change this:
9+
platform :ios, '13.0'
10+
# To this:
11+
platform :ios, '15.0'
12+
```
13+
14+
Then run `npx cap sync ios`.
15+
16+
## "No podspec found for CapacitorPluginCdvPurchase"
17+
18+
Make sure you're on the latest version of the plugin. If you're using a local path (`file:../path`), verify the podspec exists at the plugin package root.
19+
20+
## Different bundle IDs on iOS and Android
21+
22+
Capacitor does not support per-platform `appId` in `capacitor.config.json` — it's a single global value. If your iOS and Android apps have different bundle IDs, you'll need to change `appId` when switching platforms, or use Xcode schemes (iOS) / product flavors (Android) for overrides.
23+
24+
## Testing on Mac (Catalyst)
25+
26+
To test on your Mac without a physical device:
27+
28+
1. `npx cap open ios`
29+
2. In Xcode, select your Mac as the destination ("My Mac (Designed for iPad)" or "My Mac (Mac Catalyst)")
30+
3. Set your signing team and build
31+
32+
This works for testing the purchase flow with sandbox accounts.
33+
34+
## Capacitor 8 / SPM support
35+
36+
Capacitor 8 defaults to Swift Package Manager (SPM). There is a known upstream issue where the Capacitor precompiled xcframework does not export certain Swift extension methods to plugins. This affects all third-party Capacitor plugins, not just this one.
37+
38+
**If you hit build errors with Capacitor 8**, use CocoaPods instead:
39+
40+
```bash
41+
# Remove the iOS project and recreate with CocoaPods
42+
rm -rf ios
43+
npx cap add ios --packagemanager CocoaPods
44+
npx cap sync ios
45+
```

0 commit comments

Comments
 (0)