Telerik-Verified-Plugins / PushNotification

Push Notification Plugin for iOS and Android
MIT License
55 stars 57 forks source link

wkWebView support #58

Closed runspired closed 9 years ago

runspired commented 9 years ago

The identifier for this plugin incorrectly identifies it as the phonegap version still. Additionally, it does not appear to support wkWebView builds.

Plugins/com.phonegap.plugins.PushPlugin/PushPlugin.m:367:19: error: no visible @interface for 'UIView'
      declares the selector 'stringByEvaluatingJavaScriptFromString:'
    [self.webView stringByEvaluatingJavaScriptFromString:jsCallBack];
     ~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
eladmoshe commented 9 years ago

:+1:

EddyVerbruggen commented 9 years ago

@runspired @eladmoshe do you have a sample project showing the problem?

eladmoshe commented 9 years ago

Sorry, I don't have one. We have started a side project of wkWebView POC. Currently trying to see what to do with other, bigger challenges with wkwv (e.g. app cache, accessing local files).

EddyVerbruggen commented 9 years ago

Thanks.. @runspired perhaps?

runspired commented 9 years ago

@EddyVerbruggen It's quite simple to replicate with a blank project. Just install it :D

runspired commented 9 years ago

Detailed steps to replicate

Create Project

cordova create foo com.foo.helloworld

Install wkWebView compliant cordova-ios

cordova platform add https://github.com/apache/cordova-ios.git#4.0.x

Install wkWebView

cordova plugin add https://github.com/apache/cordova-plugins.git#master:wkwebview-engine --save

Check the install

cordova prepare ios && cordova build ios

\ BUILD SUCCEEDED **

Install PushPlugin

cordova plugin add https://github.com/Telerik-Verified-Plugins/PushNotification.git#master --save

Prepare the repo.

cordova prepare ios

Build for iOS

cordova build ios

Generated Error

/Users/runspired/GitHub/foo/platforms/ios/HelloCordova/Plugins/com.phonegap.plugins.PushPlugin/PushPlugin.m:367:19: error: 
      no visible @interface for 'UIView' declares the selector
      'stringByEvaluatingJavaScriptFromString:'
    [self.webView stringByEvaluatingJavaScriptFromString:jsCallBack];
     ~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

CompileC build/HelloCordova.build/Debug-iphonesimulator/HelloCordova.build/Objects-normal/i386/AppDelegate+notification.o HelloCordova/Plugins/com.phonegap.plugins.PushPlugin/AppDelegate+notification.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
    cd /Users/runspired/GitHub/foo/platforms/ios
    export LANG=en_US.US-ASCII
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Users/runspired/.rvm/gems/ruby-2.1.1/bin:/Users/runspired/.rvm/gems/ruby-2.1.1@global/bin:/Users/runspired/.rvm/rubies/ruby-2.1.1/bin:/Users/runspired/.nvm/v0.12.2/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/npm/bin:/usr/local/bin:/bin:/usr/sbin:/sbin:/usr/bin:/usr/local/share/npm/bin/:/opt/X11/bin:/Development/android-sdk-macosx/platform-tools:/Development/android-sdk-macosx/tools:/Users/runspired/.rvm/bin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch i386 -fmessage-length=80 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -fcolor-diagnostics -std=c99 -fobjc-arc -fmodules -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/var/folders/d8/jvy52v_d4qb1bg0287dwh2j80000gn/C/org.llvm.clang/ModuleCache/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-implicit-atomic-properties -Wno-receiver-is-weak -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-shorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -DDEBUG=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.4.sdk -fexceptions -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -g -fvisibility=hidden -Wno-sign-conversion -fobjc-abi-version=2 -fobjc-legacy-dispatch -mios-simulator-version-min=7.0 -iquote /Users/runspired/GitHub/foo/platforms/ios/build/HelloCordova.build/Debug-iphonesimulator/HelloCordova.build/HelloCordova-generated-files.hmap -I/Users/runspired/GitHub/foo/platforms/ios/build/HelloCordova.build/Debug-iphonesimulator/HelloCordova.build/HelloCordova-own-target-headers.hmap -I/Users/runspired/GitHub/foo/platforms/ios/build/HelloCordova.build/Debug-iphonesimulator/HelloCordova.build/HelloCordova-all-target-headers.hmap -iquote /Users/runspired/GitHub/foo/platforms/ios/build/HelloCordova.build/Debug-iphonesimulator/HelloCordova.build/HelloCordova-project-headers.hmap -I/Users/runspired/GitHub/foo/platforms/ios/build/emulator/include -I/Users/runspired/GitHub/foo/platforms/ios/build/emulator/usr/local/lib/include -I/Users/runspired/GitHub/foo/platforms/ios/build/UninstalledProducts/include -I/Users/runspired/GitHub/foo/platforms/ios/build/emulator -I/Users/runspired/GitHub/foo/platforms/ios/build/HelloCordova.build/Debug-iphonesimulator/HelloCordova.build/DerivedSources/i386 -I/Users/runspired/GitHub/foo/platforms/ios/build/HelloCordova.build/Debug-iphonesimulator/HelloCordova.build/DerivedSources -F/Users/runspired/GitHub/foo/platforms/ios/build/emulator -include /Users/runspired/GitHub/foo/platforms/ios/build/sharedpch/HelloCordova-Prefix-bwhycydmejynmsckkmiphuggdutv/HelloCordova-Prefix.pch -MMD -MT dependencies -MF /Users/runspired/GitHub/foo/platforms/ios/build/HelloCordova.build/Debug-iphonesimulator/HelloCordova.build/Objects-normal/i386/AppDelegate+notification.d --serialize-diagnostics /Users/runspired/GitHub/foo/platforms/ios/build/HelloCordova.build/Debug-iphonesimulator/HelloCordova.build/Objects-normal/i386/AppDelegate+notification.dia -c /Users/runspired/GitHub/foo/platforms/ios/HelloCordova/Plugins/com.phonegap.plugins.PushPlugin/AppDelegate+notification.m -o /Users/runspired/GitHub/foo/platforms/ios/build/HelloCordova.build/Debug-iphonesimulator/HelloCordova.build/Objects-normal/i386/AppDelegate+notification.o

** BUILD FAILED **

The following build commands failed:
    CompileC build/HelloCordova.build/Debug-iphonesimulator/HelloCordova.build/Objects-normal/i386/PushPlugin.o HelloCordova/Plugins/com.phonegap.plugins.PushPlugin/PushPlugin.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Error code 65 for command: xcodebuild with args: -xcconfig,/Users/runspired/GitHub/foo/platforms/ios/cordova/build-debug.xcconfig,-project,HelloCordova.xcodeproj,ARCHS=i386,-target,HelloCordova,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/runspired/GitHub/foo/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/runspired/GitHub/foo/platforms/ios/build/sharedpch
ERROR building one of the platforms: Error: /Users/runspired/GitHub/foo/platforms/ios/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /Users/runspired/GitHub/foo/platforms/ios/cordova/build: Command failed with exit code 2
    at ChildProcess.whenDone (/Users/runspired/.nvm/v0.12.2/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:139:23)
    at ChildProcess.emit (events.js:110:17)
    at maybeClose (child_process.js:1015:16)
    at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
runspired commented 9 years ago

Also, wkWebView is going to be released by Cordova this week (I think), so ensuring compatibility with this and other Telerik plugins would be nice :)

I think I saw this exact issue fixed by Telerik on another plugin already.

shazron commented 9 years ago

@runspired actually don't use the 4.0.x branch anymore, it's stale (and I removed it yesterday), use master. "https://github.com/apache/cordova-ios.git#master"

runspired commented 9 years ago

@shazron interesting, because most things worked with it but not with master as of last week. :/

EddyVerbruggen commented 9 years ago

Hey @runspired just to clear things up: I asked for a sample app because I actually tested this plugin with WKWebView without issues. But that was with Telerik's WKWebView plugin, which I assumed you were referring to :)

runspired commented 9 years ago

@EddyVerbruggen I tried with Telerik's at one point, but didn't make it to testing the push plugin because almost every other plugin was broken for Telerik's :P

shazron commented 9 years ago

@runspired off topic, but I'm interested in what's not working with master, and would like to fix what issues you have had with it.

EddyVerbruggen commented 9 years ago

If you need to use this plugin with Cordova's WKWebView engine Cordova-iOS 4 you can (for now) manually edit PushPlugin.m and change the offending line of code in notificationReceived to this:

   [self.webViewEngine evaluateJavaScript:jsCallBack completionHandler:nil];

I think it's best if we change the implementation of notificationReceived to use a regular Cordova plugin result handler instead of evaluating js.

EddyVerbruggen commented 9 years ago

The real problem is a lack of Cordova-iOS 4 compatibility. Created #60 to clear that up.

codersudipta commented 8 years ago

For ionic it got solved with ionic platform update iOS