Open jacobglowdev opened 8 months ago
You need to import CapactiorWatch
here as well
You need to
import CapactiorWatch
here as well
Apologies - I have updated my comment to highlight that I have tried this already.
Additional Information - after adding the package dependency, I quit xcode and tried to build it again with npm run ios
, however it now fails with the following message:
RuntimeError - PBXProject
attempted to initialize an object with unknown ISA XCLocalSwiftPackageReference
from attributes: {"isa"=>"XCLocalSwiftPackageReference", "relativePath"=>"../../node_modules/@capacitor/watch/CapWatch-Watch-SPM"}
So something has gone wrong with the adding the package dependency?
just to confirm, are you using Xcode 15?
just to confirm, are you using Xcode 15?
Yep, Xcode 15
so I just tried running the install instructions on a new cap project and encountered the same thing you have. This is happening because for some reason Xcode is now assuming everything inside an SPM is 'private' and that causes the things there to be out of scope. I'll need to make an update to the package to fix this.
Thanks - is there an estimated timeframe for this fix?
I'm hoping to get to it this week
Is there any update on this?
Appreciate this may be lower down on the list of priorities but we're also looking into adding Apple Watch functionality to our Capacitor app and this looks to be the ideal solution. Would be great to get an ETA if at all possible. Thanks š
I'm hoping to get to it this week
I understand if this isn't a priority ticket for you guys, but are you able to advise a rough timeframe for this fix? Just so I can make a decision on whether to look into alternative approaches.
I should have a little time this week. So maybe this week, but I'm not promising anything
Ok give version 0.1.11 a spin. I've also updated the README a little, in Step 6 of creating the watch app you need to add import iOS_capWatch_watch
in addition to the other changes. Let me know if this gets you up and running.
@giralte-ionic I tested your fix including the changes in step 6 in our Enterprise App and tried running ionic cap build ios
.
Sadly, the command failed basically with the same error as before.
> capacitor sync ios
[capacitor] ā Copying web assets from dist to ios/App/App/public in 117.81ms
[capacitor] ā Creating capacitor.config.json in ios/App/App in 2.36ms
[capacitor] ā copy ios in 168.15ms
[capacitor] ā Updating iOS plugins in 10.15ms
[capacitor] [info] Found 8 Capacitor plugins for ios:
[capacitor] @capacitor-community/screen-brightness@5.0.0
[capacitor] @capacitor/app@5.0.6
[capacitor] @capacitor/camera@5.0.8
[capacitor] @capacitor/haptics@5.0.6
[capacitor] @capacitor/keyboard@5.0.7
[capacitor] @capacitor/share@5.0.6
[capacitor] @capacitor/splash-screen@5.0.7
[capacitor] @capacitor/watch@0.1.11
[capacitor] ā Updating iOS native dependencies with pod install - failed!
[capacitor] ā update ios - failed!
// ...
RuntimeError - `PBXProject` attempted to initialize an object with unknown ISA `XCLocalSwiftPackageReference` from attributes: `{"isa"=>"XCLocalSwiftPackageReference", "relativePath"=>"../../node_modules/@capacitor/watch/CapWatch-Watch-SPM"}`
[capacitor] If this ISA was generated by Xcode please file an issue: https://github.com/CocoaPods/Xcodeproj/issues/new
I'm sorry the cocoapod failed to publish. I have corrected this. Please try again.
The error still persists with version @capacitor/watch@0.1.12
for me.
Stuff I tried:
rm -rf node_modules
pod cache clean --all
rm -rf ~/Library/Caches/CocoaPods
try removing your Podfile.lock
file and run npx cap sync
from your project root. I just tried an initial project setup and things worked correctly.
I'm sorry to bother you again, but I can't get it to work. I set up a completely new App with Ionic Capacitor & React, installed capacitor watch, executed the steps in your Readme and run into the error again.
You can check out this repo if you like for reproduction. I'm using XCode 15.3 & MacOS Sonoma 14.4. Maybe this is an issue with the latest XCode version?
A coworker of mine could reproduce the issue with that repo above & our production app as well.
So I pulled your repo down and there are two problems:
1) In your watch app target, add the iOS-capWatch-watch
framework to the 'Frameworks, Libraries and Embedded content' section. When you added the watch spm to the project, you didn't select the watch app as the target
2) In AppDelegate.swift, you typo'd import CapacitorWatch
:
import CapacitorWatch
//import CapactiorWatch
Fixing these two things gets me a successful build.
@JensUweB has this issue been resolved?
I've followed the documentation up to step 7, my watchOS.swift file currently looks like this:
I'm receiving the error:
Cannot find 'CapWatchContentView' in scope
I can confirm the
capacitor/watch
plugin exists in mypackage.json
file. The only other thing I can think of that may (or may not) be relevant is that after I added the Capacitor Watch Swift Package from node modules, its name reads asiOS-capWatch-watch
instead ofCapWatch-Watch-SPM
.I have tried adding
import CapacitorWatch
above the@main
statement, but this also throws theNo such module 'CapacitorWatch'
error.