Telerik-Verified-Plugins / AppleWatch

Cordova AppleWatch plugin, build the Watch UI with JavaScript!
MIT License
123 stars 36 forks source link

Not compatible with Cordova iOS 4 #24

Open studio31 opened 8 years ago

studio31 commented 8 years ago

I'm having this issue:

/applewatch/watch/platforms/ios/HelloCordova/Plugins/cordova-plugin-applewatch/AppDelegate+applewatch.m:49:25: 
No visible @interface for 'UIView' declares the selector 'stringByEvaluatingJavaScriptFromString:'

It seems you fixed it in other of your plugins: https://github.com/EddyVerbruggen/cordova-plugin-3dtouch/issues/7

Thanks for the great work, and I'm very excited to test it so I think for now I will try to build it in Cordova iOS 3.x

studio31 commented 8 years ago

For anyone having problems trying to use the plugin with the latest Cordova and Xcode, these are the steps I follow to make the demo work:

cordova create applewatchtest
cd applewatchtest
npm install xcode
cordova platform add ios@3.9.2

Use Cordova iOS 3.9.2 because the plugin is not compatible with version 4.

Xcode Open the project in Xcode and do: File > New > Target > wachOS > Application > Watchkit App for watchOS Select language ObjC, Select Glance and Notifications > Finish > Activate

cordova plugin add https://github.com/Telerik-Verified-Plugins/AppleWatch
cordova prepare

After installing the plugin you should get something like this:

Added source file DetailInterfaceController.m to HelloCordova WatchKit 1 Extension
Added source file OneColumnRowType.m to HelloCordova WatchKit 1 Extension
Added source file OneColumnSelectableRowType.m to HelloCordova WatchKit 1 Extension
Added source file ParentInterfaceController.m to HelloCordova WatchKit 1 Extension
Added source file TwoColumnsRowType.m to HelloCordova WatchKit 1 Extension
Added source file WatchKitHelper.m to HelloCordova WatchKit 1 Extension
Added source file WatchKitUIHelper.m to HelloCordova WatchKit 1 Extension
Added header file DetailInterfaceController.h to HelloCordova WatchKit 1 Extension
Added header file OneColumnRowType.h to HelloCordova WatchKit 1 Extension
Added header file OneColumnSelectableRowType.h to HelloCordova WatchKit 1 Extension
Added header file ParentInterfaceController.h to HelloCordova WatchKit 1 Extension
Added header file TwoColumnsRowType.h to HelloCordova WatchKit 1 Extension
Added header file WatchKitHelper.h to HelloCordova WatchKit 1 Extension
Added header file WatchKitUIHelper.h to HelloCordova WatchKit 1 Extension
Copied Interface.storyboard to HelloCordova WatchKit 1 App
Changed debug and release deployment targets of HelloCordova WatchKit 1 App to 8.2

XCode again

  1. Set CFBundleVersion (Bundle Version) and CFBundleShortVersionString (Bundle versions string, short) of all targets to the same value (use XCode's search feature COMMAND + SHIFT + F and change all 3 .plist values)
  2. App Groups: register an appgroup in your iOS member center (Identifiers > App Groups): we expect group., like group.io.cordova.hellocordova, then add it to your App ID. Now generate a provisioning profile with the new App ID and add it XCode (download, then double-click the file should do it). In XCode, go to your targets and add this app group to both the phone and watch app targets (Capabilities tab).
  3. Set bitcode to NO for all 3 targets. Go to 'Build Settings' and disable it 3 times.

Done, ready to build and test!

TIP: If the build failed with an error like this one:

ld: library not found for -lmmwormhole
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Use this to solve it: https://github.com/Telerik-Verified-Plugins/AppleWatch/issues/14#issuecomment-151870647

Deselect and select again the targets, clean the project and build it again.

compelling commented 7 years ago

I've forked the plugin, merged corrections made by @EddyVerbruggen to the 3d touch plugin into this one. It compiles fine now. However, i get a black screen when using the plugin under WatchOS 3... se also https://github.com/Telerik-Verified-Plugins/AppleWatch/issues/37

ustincameron commented 7 years ago

@compelling Any progress here? I'm trying to add this plugin to my Ionic/Cordova app to no avail.

`cli packages: (/Users/Admin/desktop/Watch_Test_App/node_modules)

@ionic/cli-utils  : 1.8.1
ionic (Ionic CLI) : 3.8.1

global packages:

Cordova CLI : 7.0.1 

local packages:

@ionic/app-scripts : 2.1.3
Cordova Platforms  : ios 4.4.0
Ionic Framework    : ionic-angular 3.6.0

System:

ios-deploy : 1.9.1 
Node       : v6.10.1
npm        : 5.3.0 
OS         : OS X El Capitan
Xcode      : Xcode 8.2.1 Build version 8C1002`
compelling commented 7 years ago

Nope, spent about a week trying to get it to work back in may, have given up on the plugin. Havn't checked if someone's made changes since then though.