iOS 10 FCM code doesn't work (Xcode 8.0 GM)
The code at the bottom of the FCMSwift/AppDelegate.swift for Messaging handling on iOS10 doesn't work. If i try to build or run my app I get a Swift Compiler Error:
Command failed due to signal: Segmentation fault: 11
If i remove that code i don't get that error.
I got the same error.
Yea I got the same. When I remove all ios10 code from demo, it works fine...
I've upgraded to Cocoa pod 1.0.1 and all seems to work.
I'm using Cocoa pod 1.0.1, XCode Version 8.0 (8A218a) and having this error after upgrade: Ambiguous reference to member 'subscript' on line
print("Message ID: \(userInfo["gcm.message_id"]!)")
If you experience error, try executing pod update from Terminal. I just understand that cocoapods could be storing a local copy of pods and thus it only update if we run that command.
Make sure you see something like this:
Installing Firebase 3.6.0 (was 3.2.1)
Installing FirebaseAnalytics 3.4.2 (was 3.2.0)
Installing FirebaseInstanceID 1.0.8 (was 1.0.6)
Installing FirebaseMessaging 1.2.0 (was 1.1.0)
I'm not seeing that error in xcode 8.1, so the linting may be fixed in the latest version.
same here
This is solution. To be able to receive notification when the app in background. You must implement this method in your AppDelegate
**- (void)userNotificationCenter:(UNUserNotificationCenter )center didReceiveNotificationResponse:(UNNotificationResponse )response withCompletionHandler:(nonnull void (^)())completionHandler
This is my code snippet that works:
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(nonnull void (^)())completionHandler
{
// Print message ID.
NSDictionary *userInfo = response.notification.request.content.userInfo;
NSLog(@"Message ID: %@", userInfo[@"gcm.message_id"]);
NSString* strURL = userInfo[@"URL"];
NSString* strMessageTitle = [[[userInfo valueForKey:@"aps"] valueForKey:@"alert"] valueForKey:@"title"];
NSString* strMessage = [[[userInfo valueForKey:@"aps"] valueForKey:@"alert"] valueForKey:@"body"];
// Print full message.
NSLog(@"%@", userInfo);
}
Thanks @vinamelody ! It's work for me !
Updating Cocoapods to 1.0.1 doesn't fix this for me. Also the 8.1 beta doesn't fix the issue.
edit: Fixed it by putting use_frameworks in my pod file..
Still getting segfaults in XCode 8.1
Closing on the basis of use_frameworks! and updated cocoapods. If people are still getting an issue, probably easiest to file a new one with explicit error you're seeing at this point.