I am facing problem with notification. Notification is not getting shown in device from last 12 hours. It was working earlier. Sending to other devices works fine.
I checked notification center and other thing. Notification is enabled for app.
After following
http://developer.apple.com/library/ios/#technotes/tn2265/_index.html
I have enabled Enabling Push Status Messages on iOS.
On console , device is printing some information like:
<Error>: kDataAttachStatusNotification sent, wasAttached: 1 isAttached: 1
What does it mean ? Is it getting notification from server side and failing to show and receive due to some reason ?
Edit:
After syncing logs with itunes. Logs says something like:
2013-08-01 10:51:06 +0530 apsd[76]: _getClientIdentity: already had identity: <SecIdentityRef: (some value here)>
wasUp NO isUp NO linkQualityBelowAndWOWAvail: YES wantsInterfaceAssertion YES avoidWWANOnCall NO
2013-08-01 10:51:06 +0530 apsd[76]: _getClientIdentity: already had identity: <SecIdentityRef: (some value here)>
2013-08-01 10:51:06 +0530 apsd[76]: peer(68) received XPC_ERROR_CONNECTION_INVALID
Have you requested permission from the user to present notifications?
Try adding the following code to your AppDelegate's application: didFinishLaunchingWithOptions: method:
Swift:
if (UIApplication.instancesRespondToSelector(Selector("registerUserNotificationSettings:"))) {
application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes: .Alert, categories: nil))
}
Objective-C:
if ([application respondsToSelector:#selector(registerUserNotificationSettings:)]) {
[application registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert categories:nil]];
}
Related
Context
I am in the process to implement Mac Catalyst in my iOS project. Everything is alright so far except the Google Firebase support.
I am authenticating the user with their phone number. Firebase does this in a two step process. First the device receives a silent push notification & then they are asked to enter their OTP.
The first time I tried, a window opened in safari. It just checked if I am a robot or not. Every other time I tried the window didn't come back.
All this is working with iOS. It just doesn't work on my mac.
Problem
I am getting the following warning:
[Firebase/InstanceID][I-IID003014] Running InstanceID on a simulator doesn't have APNS. Use prod profile by default.
Code
Internet.signIn(with: code) { (error) in
// This line aka the closure is never executed
if error != nil{
alert("Something went wrong", "Try resending the SMS")
return
}
alert("Verified", "Let's continue with entering further user information now") {
self.performSegue(withIdentifier: "userWasVerifiedSegue", sender: self)
}
}
Approaches
I edited my scheme & changed it to "release".
Tried to add a new mac certificate on developer.apple but it doesn't allow me to enter the bundle id.
I am working on an ionic app and I am using onesignal for push notifications.
The problem I am facing is that the handleNotifiactionRecieved() does not get triggered upon receiving a push notification when the app is not killed (that is removed from the recent apps). Though it works as expected when the app's running but in the background(not inFocus).
setup code is something like this:
if (this.platform.is('cordova')) {
this.oneSignal.startInit('APP_ID');
this.oneSignal.inFocusDisplaying(this.oneSignal.OSInFocusDisplayOption.None);
this.openOneSignalMessage();
this.oneSignal.endInit();
}
my code is something like this:
openOneSignalMessage() {
this.oneSignal.handleNotificationReceived().subscribe((data) => {
this.MsgBody = data.payload.body
console.log('newMessageOneSignal MsgBody', this.MsgBody);
});
}
actual result: handleNotificationReceived() doesn't get called when the app is not running, that is killed.
expected result: handleNotificationReceived() should be called every time a push notification arrives even when the app is not open.
How do I trigger the method every time?
Thanks in advance.
Thanks for pointing out the issue in the docs. They have been updated with the correct info:
handleNotificationReceived (builder method)
Sets a notification received handler. Only called if the app is running in the foreground at the time the notification was received.
If you want to handle from a killed state, make sure to use the handleNotificationOpened method
I find this in the doc:
Sets a notification received handler. Only called if the app is running in the foreground or background at the time the notification was received.
Maybe your app is not working on background.
Or the problem is you need to call ur function after the startinit :
this.onesignal.startInit("YOUR_APPID")
this.onesignal.handleNotificationReceived()
I use the apple's mdm and find a strange problem.
This iphone device could have been mdm control, it works fine,but suddenly lost control, see xcode the device log appears, "Rejecting MDM Push dictionary because it does not have the right magic string."
Is this how to solve this?
Aug 1 08:03:04 iPhone6 apsd(PersistentConnection)[93] <Notice>: 2017-08-01 08:03:04 +0800 apsd[93]: <APSCourier: 0x155d12f70>: Received message for enabled topic 'com.apple.mgmt.External.69e3a6a4-4f53' with payload '{
aps = {
};
mdm = "5E73DE3E-ADE2-4955-B58C";
}' onInterface: WWAN for device token: YES with priority (null)
Aug 1 08:03:04 iPhone6 mdmd(libdispatch.dylib)[4508] <Notice>: Push token received.
Aug 1 08:03:04 iPhone6 mdmd(ApplePushService)[4508] <Notice>: Received push notification.
Aug 1 08:03:04 iPhone6 mdmd(ApplePushService)[4508] <Notice>: Rejecting MDM push dictionary because it does not have the right magic string.
Your push magic doesn't seem to be correct it should almost always be in UUID format, double check that you are sending the correct one, or show the code how you're sending it/obtaining it
SOURCE:
https://media.blackhat.com/bh-us-11/Schuetz/BH_US_11_Schuetz_InsideAppleMDM_WP.pdf
The PushMagic token is a hexadecimal string, likely a simple random
UUID (in UUID format).
I am developing an app for iPad and iPhone with the Game Center Feature. The game is sending correctly one participant turns from iPad 2 IOS 6, but when I try to send the turn to another participant from an iPhone 4 IOS 5 the following error appears:
<GKTurnBasedParticipant 3d8e50 - id:(null) status:Matching outcome:None lastTurn:(null)>
2013-03-14 23:56:22.030 [453:707] ERROR::::::Error Domain=GKErrorDomain Code=3 "The requested operation could not be completed due to an error communicating with the server." UserInfo=0x7a81170 {NSUnderlyingError=0x3f4220 "The operation couldn’t be completed. status = 5008, missing required key: turns", NSLocalizedDescription=The requested operation could not be completed due to an error communicating with the server.}
2013-03-14 23:56:22.031 [453:707] Oops, there was a problem. Try that again.
I am using the following method that works perfectly on IOS 6:
[currentMatch endTurnWithNextParticipant:nextParticipant
matchData:data completionHandler:^(NSError *error) {
if (error) {
NSLog(#"%#", error);
NSLog(
#"Oops, there was a problem. Try that again.");
} else {
NSLog(#"Your turn is over.");
}
}];
The error number 3 is GKErrorCommunicationsFailure,but I cant understand what it is going on!
I logged on correctly when the app starts with the Game Center
This error will always come when you are working on Simulator instead of device, but sometimes it pops out on device, because of Push Notification Failure,
Please check if you device is receiving Push Notifications.
UPDATED
I recently figured it out that Game Center does not send push notifications to devices which does not have sim card inserted
I'm using pyapns to send notification to iPhone.
receiving notification when the app is running was success.
but, when app is not running or app is on background, it can't receive notification.
is it related with URL identifier or scheme? if not, what is the problem..?
Did you get called in
- (void)application:didReceiveRemoteNotification:
while you were in the app?
the problem from notification msg.
among the notify function args, there is notifications list arg.
note that, when you make this parameter, a dictionary of this list should contain below. so that the application can do alert reaction.
thePayLoad = {
'aps': {
'alert':'this option should be contained if you want to see the alert msg',
'sound':'k1DiveAlarm.caf',
'badge':42
},
'test_data': { 'foo': 'bar' }
}
In my case, I just sent msg not containing above. and in didReceiveRemoteNotification function, I made alert msg. but msg not containing alert information. so the device couldn't react.