I am working on an app which requires push notifications to be enabled. I have followed this article and worked fine till I downloaded the provisioning profile. I am using Rubymotion to develop this app and hence in my Rakefile I Did this,
app.name = 'Myapp'
app.identifier = 'com.myapp.development'
app.provisioning_profile = '/Users/sunilkumar/Library/MobileDevice/Provisioning Profiles/Myapp_Development.mobileprovision'
'My App' is the name of my app. Identifier is the project identifier (as per the Rubymotion docs and as per my belief thats the bundle identifier ), the default value of which I override to make it same as the App Id which I created in the IOS development center.
In my app_delegate.rb, I also have this piece of code,
UIApplication.sharedApplication.registerForRemoteNotificationTypes(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)
The issue is that when the device is connected and the app installed, the permission for push notifications is not being asked. I guess I have done almost everything right and is as per the article I linked above, but somehow it just doesn't seem to work. Any help on this would be must appreciated.
I think you might have installed this app before. iOS only ask permission for push once a day per application. So, you will need to change the system time ahead 2 days or more, reboot the device then change systime back. This will make permission alert be asked again.
Figured it out guys.
I had to set the aps-environment in my RubyMotion project's Rakefile.
app.entitlements['aps-environment'] = 'development'
app.entitlements['get-task-allow'] = true
As soon as I did, it worked for me. Thanks all for the responses.
After enabling Push notification for you app you need to create SSL certificate then generate new provisional profile.
Hope it resolve your problem
Related
I have encountered a strange problem. I'm using the Flutter tool to create my iOS app which requires Firebase phone authentication. I was able to make it work on the other app platform without any fuss, but I'm not able to make it work on iOS real device. As per the documentation, I have to register an APN key from the developer account which I did and added my app's bundle ID too. This key I had to upload in my app console in Firebase which I also did. The REVERSE_CLIENT_ID was entered in the project settings in Xcode too, so the simulator version works flawlessly.
However, when it came to make it work on the real iPhone, I get this issue
flutter: exception code verifyPhoneNumberError message Invalid token.
I just am not able to make out what the issue is. One thing to note is that I had created a native Swift version using same APN key with different App ID for test purpose. Could this be a cause? Should I create a new APN key and will that allow my old App ID?
I got it working by doing a couple of things. I don't really know which one is the actual reason of it working, but along with official docs, I also followed this blog post https://medium.com/flutter-community/flutter-adding-sign-in-with-google-and-phone-authentication-to-your-app-69f681518f9b for help and achieved it due to the blogger's additional help when asked.
Basically I created a new APN key altogether for both push notifications and Firebase phone authentication, then uploaded in Firebase console (removing my old one). Later, the blogger suggested I also enable Background modes for remote notifications in my Xcode project settings. I didn't know this, as I had thought the Push Notifications switch was enough. Anyhow, bam! it started working.
i have setup all the steps for push notification using https://firebase.google.com/docs/cloud-messaging/ios/first-message#access_the_registration_token but i didn't get notification in ios App but working in Android App and also with http://pushtry.com .how to resolve this issue
I was facing the same problem and after searching for a day here are my conclusions:
Don't forget to allow for push notification in your App ID.Click on edit and then enable push notification.
Make sure your certificates you are using are correct because as you allow for push notification your previous profiles become invalid(In my case they were).So either edit the provision profiles and download again or create new ones.
3.I'll prefer using Apn-auth key as suggested on main firebase site instead of apns certificates.
4.One of the major point which I was missing was the problem with xcode Enable push notification there in the xcode as well which
are not enabled by default.
If your app is closing soon after opening your plist might be the cause Follow this answer for solution .
Last thing that really helped me fix the issue was a mac OS update.I was trying to build using xcode 7.2 which was quiet dumb part on my
side.There when I tried to enable push notification.It made changes to
my certificates and then I downloaded the provisional profile after
editing them(So valid now) and then build and everything started
working fine as hell.
I have a problem with Firebase Cloud Messaging on iOS. I have implemented Firebase into the app like stated in the docs and a Firebase instance id is generated. However, if I try to send a push notification (for example using http://pushtry.com/), nothing happened. The thing is, it did work, and I don't remember changing anything to do with notifications.
Because I couldn't find anything, I even tried deleting the whole project and doing everything again from scratch (by copying the code). Then it worked again, but now (an hour later) again, it again doesn't work.
If I send a FCM from pushtry or from the Firebase Console, it says the message is delivered, but nothing happens! (Push notifications are enabled in the iOS Settings. It did work)
I really don't know what to do. Does anybody know about anything I could do?
Thank you in advance.
Okay after two whole days of utmost frustration, I figured it out.
The problem was the line FirebaseAppDelegateProxyEnabled set to NO in the info.plist file.
After I removed the line, the problem was gone!
I am so relieved right now
set parameter content_available to true
In my case, I had migrated my Apple account and forgot to configure both my Apple and Firebase account correctly.
Apple side
Make sure that "Push Notification" is enabled for that app id.
Make sure that you had created "Apple Push Notification service" certificate and attached to the Apple Id.
Create an Authorization Key that will be later updated load Firebase so it can communicate with Apple servers in your behalf. (link)
Firebase side
Make sure your iOS apple bundle is set correctly in your Firebase project
Upload the Authorization key you created before in Apple - Step 3 above. (link)
Follow all the steps to have the iOS app integrated with Firebase SDK
That is it.
I hope you can help me troubleshoot my issue.
When I install my app, I don't get the message alert asking for the authorization to get push notifications.
I am thinking that if I don't get this message it's not my code to be wrong, but maybe it's a matter of certificates.
Am I right? How can I check if my provisioning file is correct?
I am using Xcode 5 and testing on ios7.0.2
I add a little more: I was never able to get the alert working
I had this issue when developing an app, it turned out I'd not set the entitlements up correctly. So make sure you have in your AppDelegate:
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:
(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
Make sure in Developer Center you've generated an AppID for your application as well, specifying that you want to use Push Notifications. Then you need to generate a Provisioning Profile to use for development/deployment with the device ID you want to install it on. Then you need to bring that Provisioning Profile into Xcode, and apply it to your project within the target build settings. That should bring up the Push Notification alert view to get the permission for the app to use push notifications. You then get the fun of setting up the SSL certificates but that's a whole other topic.
I found the Ray Wenderlich Push Notification Tutorial incredibly helpful when I went through it, I'd recommend following through if you're finding yourself stuck.
Edit; also keep in mind Push Notifications do not work on the Simulator, you must test them against an actual device as you won't see the alert view at all on the Simulator.
If you accept or decline it once this screen would not appear again. Go to setting and check permission for push notifications for your app.
Settings->Notifications->YOUREAPP
In order to see the alertView:
uninstall the app
set the device date to at least 1 day after the current date
Reboot the device
Install and launch the app
I have so far done the following:
- Generated certificate and private key as .pem, also cat'd them together. Successfully connected to gateway.sandbox.push.apple.com.
- Using the provisional profile with push notifications is enabled for development, I have a basic app that successfully prompted "Do you want to allow push notifications", so this is working correctly
- Obtained the device token
- I have tried pulling a few pre-made files for SSLing into sandbox from the internet just to see if I can get them running before I start development.
The files are the php file posted here: http://www.raywenderlich.com/3443/apple-push-notification-services-tutorial-part-12. I actually got a "Message successfully sent"
The python file posted here: Apple PNS (push notification services) sample code; I had to edit the Python 3 command "fromhash" line to str(float.fromhash(...))
I also tried using the PyAPNs API: https://github.com/simonwhitaker/PyAPNs. I still have use_sandbox set to true.
Obviously I changed the device tokens and public keys/certificates to my own. Sadly I have not received any pushed notifications yet, and I'm not receiving any concrete errors to tell me why. If anyone can shed some light, that would be amazing.
From my comment in radesix's answer, and apologies that I can provide no more detail as it's been a year since I've touched iOS development.
The problem was my provisional profile had the "aps-environment" key set to developer, but for some reason xcode defaulted to "debug". Changing this in the editor solved my problem.
Use a service like urban airship (urbanairship.com) and you'll have this up and running in minutes. Less for you to maintain in the long run also.