I have a flutter app that i am trying to get Firebase cloud messaging to work on but for some reason it refuses to work when deploying to test flight.
If i run in debug mode through VSCode everything works as it should but as soon as i run flutter build ios and deploy to test flight everything breaks.
I have tried a multitude of solutions over the past couple of days including:
Removing and re-adding all certs & provisioning profiles
changing <key>FirebaseAppDelegateProxyEnabled</key><false/> to <key>FirebaseAppDelegateProxyEnabled</key><string>0<string/> AND to <key>FirebaseAppDelegateProxyEnabled</key><string>NO<string/>
trying to force the APNS token to be a production token by adding this to
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { #if DEVELOPMENT //Develop Messaging.messaging().setAPNSToken(deviceToken as Data, type: .sandbox) #else //Production Messaging.messaging().setAPNSToken(deviceToken as Data, type: .prod) #endif }
I have also tried doing different combinations of the above in the hope that one of the solutions would work in tandem with each other.
if anyone can shed some light on why this might be happening i would be extremely grateful!
Related
I'm trying to transition my iOS app from Crashlytics to Firebase, since Crashlytics is going to be shut down in a month. I went through the steps described here:
https://firebase.google.com/docs/crashlytics/get-started-new-sdk
It all looked great until I tried my first test distribution. I added a piece of code that would crash the app on a button tap to test that I get the crashes from distributed apps. However, it didn't work. The app crashes, but I see no crash reports. I do see that Crash-free users percentage is going down though. So something is getting registered, but the actual crashes are not there.
My fists couple of test distributions were missing DSYMs. And under DSYMs tab I could even see the crash count. However, when I did upload the DSYMs the crashes still didn't appear.
Now I'm using a script that does the DSYM upload on archive, but crashes are not showing up still.
When I do a build using Xcode and force crash everything works as expected. It's only the distributed AdHoc builds don't show any crashes in the portal.
Any kind of help is highly appreciated.
If your forced crash didn't crash, crashed before you wanted it to, or you're experiencing some other issue with Crashlytics, you can enable Crashlytics debug logging to track down the problem.
To enable debug logging on your development device, specify the following command line argument in Xcode:
Crashlytics 3.11.1+
-FIRDebugEnabled
Previous versions
func application(_ application: UIApplication, didFinishLaunchingWithOptions
launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Initialize Firebase service.
FirebaseApp.configure()
Fabric.sharedSDK().debug = true
return true
}
Boom, after hours of trying and searching.
https://github.com/firebase/firebase-ios-sdk/issues/2901
Disabling bitcode for AdHoc builds fixed it for me.
I created an APP for both iOS and Android and I used APN to get deviceToken for iOS and GCM for Android. I decided to migrate to firebase to make token management easier. I noticed a issue just for iOS application and I was wondering if someone else encountered it too.
When I migrated iOS app to firebase, token was not regenerated unless the app was reinstalled. I follow the firebase guide to do it but with no result.
Someone else has this problem?
Thanks in advance
I solved my problem.
I switch off and switch on capabilities
I restarted XCode
I put FIRInstanceIDAPNSTokenType to prod and now all seems to work
func application( _ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data ) {
FIRInstanceID.instanceID().token()
FIRInstanceID.instanceID().setAPNSToken(deviceToken, type: FIRInstanceIDAPNSTokenType.prod)
}
I'm working on an app that has push notifications enabled. My app it's using push notifications since day 1 with parse.com as the server.
Everything was working fine, I did several app updates and improvements and I had always receive one notification for each push sent by the server, I've also updated from parse 1.7.2 to 1.12.0 without having issues.
Because parse.com was going to terminate its services, I started the migration from parse to Urban Airship (using 7.0.2).
I did several tests, installing and uninstalling the app on my phone, installing the production version (using parse) and installing the development version (using urban airship), everything was working fine, when suddenly and I don't know why, I started receiving 5 notifications per push sent by the server. I thought it was a parse.com problem because at that time my iPhone was running the production version (with parse), but it was not.
When the version (using Urban Airship) was just published, I kept receiving 5 notifications.
I'm totally lost here, I don't have any clue why this is happening, at first I thought it was related with the several installs and uninstalls of the app, so I try:
1. Disabling notifications.-
2. Deleting the app.-
3. Disabling notifications
3.a. deleting the app
3.b. then changing time and date ahead a couple of days
3.c. then turning off the phone
3.d. turning on again and putting the right date
3.e. restarting the phone
3.f. installing the app
None of those worked so far. And I couldn't find anything online about this issue that was clear or solve this issue.
I hope someone could help me.
Extra info:
Swift 2
iOS 8.0+
XCode 7
Pushes are sent by a PHP Server
My AppDelegate.swift (Please notice that I have only included the relevant code, the rest of the code is not related):
import UIKit
import CoreData
import AirshipKit
#UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let config: UAConfig = UAConfig.defaultConfig()
UAirship.takeOff(config)
UAirship.push().userPushNotificationsEnabled = true
UAirship.push().resetBadge()
// Get the user settings
let userSettings = NSUserDefaults.standardUserDefaults()
var notify = userSettings.dictionaryForKey("notifications")
let appReset = userSettings.objectForKey("appResetv200")
if appReset == nil {
notify = nil
userSettings.setObject("done", forKey: "appResetv200")
}
if notify == nil {
let notificationTypes = [
"notType1" : true,
"notType2" : true,
"notType3" : true
]
userSettings.setObject(notificationTypes, forKey: "notifications")
UAirship.push().addTag("notType1")
UAirship.push().addTag("notType2")
UAirship.push().addTag("notType3")
UAirship.push().updateRegistration()
}
return true
}
}
I hope someone can help me, everything worked fine when I did the tests on my development environment, and now it's a complete mystery why it's failing.
I want to use Crashlytics on my application. I followed every step but I'm stuck on "Verifying Installation..." step.
What is the problem ?
setDebugMode = YES
set below code before [Fabric with:#[ TwitterKit ]]; if applied for twitter kit. Or you can simply past below code in didFinishLaunchingWithOptions.
// Swift
Crashlytics().debugMode = true
Fabric.with([Crashlytics.self()])
// Objective-C
[[Crashlytics sharedInstance] setDebugMode:YES];
[Fabric with:#[[Crashlytics class]]];
Now build and run your app and check fabric UI window, it will move ahead to complete screen.
I resolved the problem.
I put my code in applicationDidFinishLaunching(application: UIApplication) instead of func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?)
It seems silly but sometimes you need to make a code change (like a simple NSLog statement) to kick the verification.
If you're adding a new app you need to be an Admin of your organization but you may just be a User.
Just had the same issue on Mac.
In my case the guide shown in the Fabric application was completely missing a crucial step: there was nothing about adding the API key!
So make sure your API key is added to info.plist, otherwise the application gets stuck at verifying installation.
Simply login to Fabric and follow this manual installation guide to make sure everything gets done correctly. Once you complete the last step you can go straight to the dashboard.
I have occurred the same problem. I run the app on iPhone. After I deleted the app and pressed CMD + R on iPhone, the problem is solved.
If you have already installed twitter/Digits kit using fabric before, then you will find Fabric.with([Digits.self, Twitter.self]) in your "AppDelegate.swift" file . Replace it with the following code Fabric.with([Digits.self, Twitter.self, Crashlytics.self]) if you want to use all three. Now press Cmd + R to finish the installation.
Another possible solution is to run the app with connectivity on the device/simulator, as indicated in here.
It could be that the app was already added to your team's account and that all you needed was an access to it. Here's a thread about the same issue: https://twittercommunity.com/t/hmmm-seems-like-your-kit-isnt-activating/73601/9.
My app has background modes enabled with Background Fetch checked and I validated the plist includes the appropriate fetch mode.
I have also configured the interval as follows:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
application.setMinimumBackgroundFetchInterval(UIApplicationBackgroundFetchIntervalMinimum);
return true;
}
And I have added the handler as follows:
func application(application: UIApplication, performFetchWithCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) {
// Get some new data here
completionHandler(UIBackgroundFetchResult.NewData);
}
I tried going to Debug->Simulate Background Fetch, but no matter what it never enters the performFetchWithCompletionHandler. I also tried to run the app under a scheme that has the "Launch due to a background fetch event" option checked. Running under this scheme simply launches the application as usual in the simulator with no call to performFetchWithCompletionHandler.
Any ideas?
Thank you!
EDIT: This appears to be affecting the release version of my app as well so it may not be isolated to the simulator. I am running Swift 1.2.
EDIT 2: My bug report was just closed because it is a duplicate of another bug report outlining the same issue. There is still no information confirming the issue is isolated to the simulator.
EDIT 3: No mention of a fix in the Xcode 6.4 Beta 2 release notes. :-(
Here's the only way I've found to test background fetch.
Edit your scheme
Select Run
Select Options
Check the "Launch due to background fetch event" option
Plug-In your iOS Device and run the application on it. It does not work in the iOS Simulator.
Take a look on the XCode release note: https://developer.apple.com/library/ios/releasenotes/DeveloperTools/RN-Xcode/Chapters/Introduction.html
"The Xcode menu command Simulator Background Fetch does not work.
Use the menu command in iOS Simulator instead. (20145602)"
You can create your own background fetch push notification to your real device via Houston
install Houston: Open Terminal app and use sudo gem install houston
create PEM certificate for your app Generate .pem file Used to setup Apple PUSH Notification
Get your device token from
func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData)
run Terminal and use
for usual push notification: apn push "<your_device_token>" -c /path/to/apple_push_notification.pem -m "Hello from the command line!"
for background fetch push notification: apn push "<your_device_token>" -c /path/to/apple_push_notification.pem -n
More options for apn app:
c.option '-m', '--alert ALERT', 'Body of the alert to send in the push notification'
c.option '-b', '--badge NUMBER', 'Badge number to set with the push notification'
c.option '-s', '--sound SOUND', 'Sound to play with the notification'
c.option '-y', '--category CATEGORY', 'Category of notification'
c.option '-n', '--[no]-newsstand', 'Indicates content available for Newsstand'
c.option '-d', '--data KEY=VALUE', Array, 'Passes custom data to payload (as comma-delimited "key=value" declarations)'
c.option '-P', '--payload PAYLOAD', 'JSON payload for notifications'
c.option '-e', '--environment ENV', [:production, :development], 'Environment to send push notification (production or development (default))'
c.option '-c', '--certificate CERTIFICATE', 'Path to certificate (.pem) file'
c.option '-p', '--[no]-passphrase', 'Prompt for a certificate passphrase'
In Xcode 8.3.2 this problem doesn't exist. Debug->Simulate Background Fetch does its job. It even works on a simulator.
This method is called.
func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: #escaping (UIBackgroundFetchResult) -> Void) {
}
you forgot to write #escaping after completionHandler