gonzaloaune / GCMPushPlugin

Push notifications for Cordova (GCM & Native support)
MIT License
37 stars 20 forks source link

On iOs: Missing Goolge/CloudMessaging.h file #10

Closed Vahn84 closed 9 years ago

Vahn84 commented 9 years ago

Building the app for ios generates this error...

Thanks

Vahn84 commented 9 years ago

i've managed to import it correctly installing dependencies with cocoapods. Now it gives this error

Undefined symbols for architecture armv7: "_kGGLInstanceIDScopeGCM", referenced from: -[GCMPushPlugin didRegisterForRemoteNotifications:] in GCMPushPlugin.o -[GCMPushPlugin onTokenRefresh] in GCMPushPlugin.o "_kGGLInstanceIDRegisterAPNSOption", referenced from: -[GCMPushPlugin didRegisterForRemoteNotifications:] in GCMPushPlugin.o "_kGGLInstanceIDAPNSServerTypeSandboxOption", referenced from: -[GCMPushPlugin didRegisterForRemoteNotifications:] in GCMPushPlugin.o "_OBJCCLASS$_GGLInstanceIDConfig", referenced from: objc-class-ref in GCMPushPlugin.o "_OBJCCLASS$_GGLInstanceID", referenced from: objc-class-ref in GCMPushPlugin.o "_OBJCCLASS$_GCMConfig", referenced from: objc-class-ref in GCMPushPlugin.o "_OBJCCLASS$_GCMService", referenced from: objc-class-ref in GCMPushPlugin.o "_OBJCCLASS$_GGLContext", referenced from: objc-class-ref in GCMPushPlugin.o ld: symbol(s) not found for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Vahn84 commented 9 years ago

i had to set the "other linker flags" to $(inherited)

comiguel commented 9 years ago

Please @Vahn84 I have the same error, could you explain with more details please?, sorry but I'm not a advance iOS developer, only with Cordova. Thanks in advance :)

Vahn84 commented 9 years ago

In the build settings of the Xcode project you'll find a voice named "other linker flags". Inside the right column of that voice you have to put that command

scripterkaran commented 9 years ago

also make sure you add this $(inherited) only to target. not to the project's other linker flags.

comiguel commented 9 years ago

when I paste $(inherited) there is replaced by "-weak_framework CoreFoundation -weak....." but when I select again to edit, is again $(inherited). Is correct this behavior? but the error continue :(

scripterkaran commented 9 years ago

you have to add , not replace the other links flags, Post a pic if you can here.

comiguel commented 9 years ago

This is what I'm doing: screen shot 2015-10-15 at 2 07 34 am

and this is the error: screen shot 2015-10-15 at 2 11 37 am

scripterkaran commented 9 years ago

try -$(inherited).

comiguel commented 9 years ago

When I try: screen shot 2015-10-15 at 7 04 54 am

Could you list the steps one by one please?. Once having all certificates and the Google.plist file what I do is: Don't install the plugin via "cordova plugin add" because this produces the error "Missing Goolge/CloudMessaging.h" so, I install vía cocoapods adding "pod Google/CloudMessaging" to the pod file that is when I have this error. Many many thanks in advance.

comiguel commented 9 years ago

Hello colleagues, I finally set everything correctly, added $(inherited) before the installation with Pod and ready, now my problem is the same of many of yours :( #4 Anyone could make it work?

scripterkaran commented 9 years ago

I am afraid that its still an issue. If you are able to solve this issue(#4) then do share the solution/workaround.

comiguel commented 9 years ago

Wich version of iOS are you tried?

scripterkaran commented 9 years ago

9, 8 and 7 as well. issues are same as mentioned in #4

comiguel commented 8 years ago

Hello colleagues, have not yet been able to run the notifications :( I'm getting the following error in the console: "enabledRemoteNotificationTypes is not supported in iOS 8.0 and later". Please help me, I'm going crazy

malah-code commented 8 years ago

This may help: I had similar problem, and it's fixed by using content_available and priority options as shown in below documentation:

You should send "content_available":true, and "priority":"high",

https://developers.google.com/cloud-messaging/http-server-ref

enter image description here kbqij

Sample JSON request:

{ "content_available":true, "to":"fd4...23f7", "priority":"high", "notification": { "body":"anything", "title":"any title" } }

turbobuilt commented 8 years ago

Hello guys,

I'm having the same problem as conmiguel. I added -$(inherited) and get the unsupported option '--weak_framework" error. How did you fix that @comiguel?

malah-code commented 8 years ago

tryout this version instead, it's working with me with minor changes https://github.com/malah-code/GCMPushPlugin

edvenkat commented 8 years ago

What change u did?

malah-code commented 8 years ago

version and configurations changes, check the code diff for details https://github.com/gonzaloaune/GCMPushPlugin/compare/master...malah-code:master

edvenkat commented 8 years ago

Any changes for ios

malah-code commented 8 years ago

You should follow the Google GCM documentation for setup ios project before this plugin could work

edvenkat commented 8 years ago

I got alert for "Would like to send notification" but not getting the Registration key .....please advice

If i missing any thing. FYI - register method only called.... initWithWebView,didRegisterForRemoteNotifications,didReceiveRemoteNotification are not called...

edvenkat commented 8 years ago

I got registration id....but i click the notification onNotification function not called malah -code please advice...

mategvo commented 8 years ago

Hey, I had the plugin working, it stopped after updating cordova to latest ios version (I think, not sure if that's exactly what happened because at first I didn't notice that push stopped working)

I've noticed that the function that's not working is: "didRegisterForRemoteNotifications" in GCMPushPlugin.m, up to that point everything works.

I am not sure what is wrong, last idea I have is: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didRegisterForRemoteNotifications:) name:CDVRemoteNotification object:nil]; that this observer is not working, but I don't understand why

Can someone help?

mategvo commented 8 years ago

How I know that the plugin is broken at that point, is that I added NSLog to AppDelegate+Notification.m

- (void) application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken {
    NSLog(@"Token: %@", deviceToken);

...and I do see the deviceToken in xcode console.

2016-04-13 13:19:56.923 theApp[353:45275] Token: <313b3f3b 79210870 2f4c070c 3c1e3b5f 34f9a749 848e29ba 626c5dea e0af15b3>

mategvo commented 8 years ago

back at GCMPushPlugin.m, this function is never fired:

- (void) didRegisterForRemoteNotifications:(NSNotification*)notification {
    NSLog(@"did register and should be passed");

My javscript function looks like this:

           successHandler = function(result) {
            console.log('success handler')            
            console.log(result)
            var device_token = result.gcm;
            device = window.device
            var deviceRegistrationData = {
                token: device_token,
                os: device.platform.toLowerCase(),
                description: device.model
            }

            devicesService.save(deviceRegistrationData, function(response) {
                $window.localStorage['dt'] = response.data.deviceId
                window.location.hash = 'account'
            });
        }

        errorHandler = function(error) {
            console.log('notification registration error')
        }

        GcmPushPlugin.register(successHandler, errorHandler, {
            "badge": "true",
            "sound": "true",
            "alert": "true",
            "usesGCM": true,
            "sandbox": false,
            "jsCallback": "onNotification"
        });
mategvo commented 8 years ago

And to help you a bit with missing header, just add this line in "Classes/AppDelegate.m"

#import <Google/CloudMessaging.h>