Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stuck on loading screen #21

Open
spencercarli opened this issue Jan 7, 2015 · 36 comments
Open

Stuck on loading screen #21

spencercarli opened this issue Jan 7, 2015 · 36 comments

Comments

@spencercarli
Copy link

I've got an existing app that runs fine on iOS prior to adding this package. However, when I add raix:push to the app it hangs on the loading screen. The prompt to give the app permission to send push notifications never appears. The app still runs fine in the browser.

In xcode output I get the logs: active and Attempting to badge the application icon but haven't received permission from the user to badge the application

The thing that has got me stumped is that I was able to get push notifications working on a very basic app.

I've set Push.debug = true; on both client and server but I'm not getting any output there.

Any debugging help would be greatly appreciated! Thanks

@dennisharrison
Copy link
Collaborator

I had this issue as well on the emulator, but ran fine on a device. Are you trying to do anything with Push right away on client init?

@raix
Copy link
Collaborator

raix commented Jan 7, 2015

You need to create new certificates, I'll guide you to the readme about ios and the wiki walktrough
I've added #22 to track fallback behaviour on missing permissions

@spencercarli
Copy link
Author

@dennisharrison,
I'm having the same issue on both the emulator and device.
The only reference I've got to Push is Push.debug = true;

@raix,
The certificates are working on a bare bones version of this app and when I test them with openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert <your_certificate_file>.pem -key <your_keyname>.pem

@dennisharrison
Copy link
Collaborator

@spencercarli,
First thing that comes to mind, is the bundle ID proper in xCode?

How have you determined the bare bones version of the app works?
Built a new app and used the same bundle ID and created the certificates for it, and then copy/pasting the certs and code to your bigger project?

Dev certs or Prod certs?

@spencercarli
Copy link
Author

Bundle ID and provisioning profile are correct.

I'm using dev certs

Determined bare bones app works by running on my phone and sending notifications via the meteor shell. The app is super simple... created with

  • meteor create test-push
  • meteor add-platform ios
  • copied my cert and key to private folder
  • copied over `mobile-config.js
  • copied over config.push.json
  • Run via meteor run ios-device --mobile-server 192.168.1.6:3000

@dennisharrison
Copy link
Collaborator

OK, can you try to clean the project in xCode or better yet can you do a meteor reset and rebuild for xCode?

@spencercarli
Copy link
Author

Did a meteor reset as well as deleted my local cordova build (via rm -rf .meteor/local/cordova-build) but still having the same issue

@raix
Copy link
Collaborator

raix commented Jan 7, 2015

@spencercarli sorry I ment the cert/provisioning profile etc. for the app / client - are you on ios7 or 8?

btw. you can connect ios 8 to your mac safari for debugging - a white screen is typically some js error - its hard to debug otherwise

@dennisharrison
Copy link
Collaborator

@spencercarli,
This still sounds like a provisioning profile mismatch if it's the same error. The profile you're using, what is it's status in Dev Member Center?

@ndevr
Copy link

ndevr commented Jan 7, 2015

I have exactly the same problems. see #20

@ndevr
Copy link

ndevr commented Jan 7, 2015

After using the fallback client #20 i received the permission dialog and not have the "Attempting to badge the application icon but haven't received permission from the user to badge the application" warning anymore.

@spencercarli
Copy link
Author

@raix,
Running ios8. Will try the the debugging via safari

@dennisharrison,
Profile is active and has Push Notifications as an enabled service.

@ndevr,
Will read through and try out #20!

@spencercarli
Copy link
Author

Thanks everyone! I followed through the thread in #20 and I've got notifications working. I'm still having a couple problems but I don't think they're related to this issue anymore.

Thanks for the package!

@ndevr
Copy link

ndevr commented Jan 7, 2015

The stuck on loading depends on a timeout with invalid data which i found on debugging.

@ndevr
Copy link

ndevr commented Jan 7, 2015

Looks like the cordova plugins are not fully loaded. packages/meteor/startup_client.js @ Line 12
bildschirmfoto 2015-01-08 um 00 04 12

@raix
Copy link
Collaborator

raix commented Jan 7, 2015

Hmm, 9902b8d

@spencercarli
Copy link
Author

That seems to be consistent with what I'm finding too. The only way I can get things to work is if I throw an alert (outside of a Meteor.startup) on the client. Otherwise I'm stuck on the loading screen

@idmontie
Copy link

idmontie commented Jan 8, 2015

I followed the steps at https://github.com/raix/push/wiki/iOS-Micro-Walkthrough but I am still experiencing this problem.

Xcode's last debug statement is:

DEBUG loading filepath: /var/mobile/Containers/Bundle/Application/1F368B45-64FA-47E5-B9FE-83388AC83D05/meteor-push-example.app/www/application/index.html for path: %2Fpush.config.web.cordova_plugins.js

@ndevr
Copy link

ndevr commented Jan 8, 2015

@idmontie same last statement for me.

I'am sure that not all plugins loaded correct because when I'am building the project again (2-3 times) it works then.

@spencercarli
Copy link
Author

@raix, I was working on this more. Seems the issue arises when you have multiple cordova plugins in a single application.

Put together a demo repo here: https://github.com/spencercarli/meteor-push-bug. I added notes to the readme.

Have you ever seen this behavior before?

@bryanterrell
Copy link

I'm seeing the same behavior on Android - the splash screen followed by a white screen, which it hangs on - but only on 4.2.2, not on 4.1.x or 4.4.4. Built another app with just packages and narrowed it down to the Semantic-UI package (nooitaf:semantic-ui@1.6.2) and the push package - they seem to interfere with one another. If I remove the config.push.json file for the push package and rebuild then the app comes up. I'm not seeing any errors in the server console running with --verbose and Push.debug = true on client and server.

Also stripped out anything not necessary from the config.push.json:

{
    "gcm": {
        "apiKey": "api-key-here",
        "projectNumber": 1234567890
    },
    "production": false
}

Was going to use the old method of Push.init(), but would prefer to not use something that's deprecated so not sure where to go from here.

@raix
Copy link
Collaborator

raix commented Jan 11, 2015

Not sure if/why the packages conflict

@bryanterrell
Copy link

Yeah, that didn't make much sense to me, either. I think maybe Semantic-UI was masking the issue. I just removed the Semantic-UI package from the new meteor test app I created, leaving the default packages and the push package with the config.push.json shown above and I'm now getting this error:

(android:http://meteor.local/cordova.js:1044) processMessage failed: Error: ReferenceError: onNotificationGCM is not defined

Seems like it could be a race condition, but not sure. I'm looking at that error now. Thanks for your help - appreciate it!

@spencercarli
Copy link
Author

For anyone else who might have an issue with getting stuck on the loading screen I used this workaround.

Instead of using config.push.json I manually did the Push.config({}) on the server and client

So on the server I have:

Push.Configure({
  apn: {
    passphrase: 'xxxx',
    certData: Assets.getText('cert.pem'),
    keyData: Assets.getText('key.pem'),
  },
  production: false
});

and client is

Push.Configure({});

Hope this can help someone trouble shoot their issues.

@idmontie
Copy link

Should we just load the passphrase from an untracked Asset file then?

@bryanterrell
Copy link

Thanks, I did the same and it's working. We're probably going to keep using this approach until JellyBean is reduced to single digit market share and then remove support for it.

Only thing I did different was store the passphrase outside of our source repo (using Meteor Up and Meteor.settings) for security reasons - figured the key was OK to store in source code, but not both. The way we store private keys, passphrases, etc. is to use an encrypted sparse image on a Mac and share that.

@raix
Copy link
Collaborator

raix commented Jan 13, 2015

@spencercarli I'm sure this is a load order issue - did you try $ meteor --production ?
I guess the we could solve it by putting the generated Push.Configure in a Meteor.startup

@spencercarli
Copy link
Author

@raix yeah that's what I'm thinking. Never tried the meteor --production (didn't even know that was a flag)

Thanks for the package! It's working great

@jimmiebtlr
Copy link

I'm not sure if this is related but

"Any functionality which relies on a Cordova/Phonegap plugin should wrap code in a Meteor.startup() block."

https://github.com/meteor/meteor/wiki/Meteor-Cordova-Phonegap-integration

@raix
Copy link
Collaborator

raix commented Jan 14, 2015

The code in raix:push should already do this - but I think theres a load order issue - I'm not 100%, havent checked yet

@krishnaff
Copy link

Hello,

I followed all the steps above, finally #21 (comment) worked.
Unfortunately, still stuck with the following:

(STDERR) WARNING: Push APN is in development mode
Push: Got push token from app: { id: 'rZCfKmPpZcpLqwJX6',
  token: { apn: 'f6a017c4d0e5d56ea7dc0710fff089b5f89d3c7bc49b206aaeab19144653d545' },
  appName: 'main',
  userId: null,
  metadata: {} }
Exception while invoking method 'raix:push-update' Error: Match error: Unknown key in field metadata
    at packages/check/match.js:299:1
    at Function._.each._.forEach (packages/underscore/underscore.js:113:1)
    at checkSubtree (packages/check/match.js:290:1)
    at check (packages/check/match.js:32:1)
    at [object Object].Meteor.methods.raix:push-update (packages/workpop:push/lib/server/server.js:17:1)
    at maybeAuditArgumentChecks (packages/ddp/livedata_server.js:1599:1)
    at packages/ddp/livedata_server.js:648:1
    at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
    at packages/ddp/livedata_server.js:647:1
    at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
Sanitized and reported to the client as: Match failed [400]

Also,

  • Certificates correct, working, connecting to sandbox
  • --mobile-server is set correctly with port number
  • Bundle ID in Xcode is correct, and Code signing is not 'automatic'
  • Alert for push.addListener('token') shows up correctly on iPhone
  • After i login to my app, the userId is also populated correctly, instead of 'null' (in logs)

Unable to figure out any possible reason for this not working.
Any help/hints/suggestions would be greatly appreciated!
Thanks

@spencercarli
Copy link
Author

Just guessing here but I think it's failing because the field metadata isn't in the check for the method raix:push-update https://github.com/raix/push/blob/master/lib/server/server.js#L17-L22

Also, it seems like you're using workpop:push rather than raix:push.

@krishnaff
Copy link

YES! Thank you so much, @spencercarli !!
This was driving me nuts. I don't know what made me drift towards using workpop:push. That was the issue. Changed to raix:push and it works flawlessly. Thanks again!

@krishnaff
Copy link

Hi @spencercarli
The standard config.push.json is not working for me, so I used your method on the server:

Meteor.startup(function () {
    Push.debug=true;
    Push.Configure({
      apn: {
        passphrase: 'check3412',
        certData: Assets.getText('PushChatCert.pem'),
        keyData: Assets.getText('PushChatKey.pem'),
        gateway: 'gateway.sandbox.push.apple.com'
      },
      production: false,
      sound: true,
      badge: true
    });
  });

I was wondering if the sound works by setting it to sound: true in Options. I'm not really looking for a customized sound, just the default notification when the push is delivered to the device.
Is this possible? Does this need to be set on the Client only?
Thanks!

@spencercarli
Copy link
Author

@insaneinc01 I didn't implement sounds in my app but maybe the comments in this issue could help: #9

@raix
Copy link
Collaborator

raix commented Mar 18, 2015

Is this still an issue on the latest version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants