Skip to content

Commit 0b5ae12

Browse files
authored
Merge pull request #629 from OneSignal/fix/pushSubId
[Fix] Push subscription Id and Token on iOS
2 parents 58e0c05 + b71babf commit 0b5ae12

File tree

4 files changed

+9
-13
lines changed

4 files changed

+9
-13
lines changed

OneSignalExample/Assets/OneSignal/CHANGELOG.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Fixed
9+
- Push subscription Id and Token malloc error on iOS
10+
811
## [5.0.0]
912
### Changed
1013
- Removed `SetLaunchURLsInApp`
1114
- Removed async from location request permission and updated method name to `RequestPermission`
1215
- Updated included iOS SDK to [5.0.1](https://github.com/OneSignal/OneSignal-iOS-SDK/releases/tag/5.0.1)
1316
- Updated included Android SDK to [5.0.0](https://github.com/OneSignal/OneSignal-Android-SDK/releases/tag/5.0.0)
14-
- Updated default OneSignal Android notificaiton icons to new logo
17+
- Updated default OneSignal Android notification icons to new logo
1518
### Fixed
16-
- Outcome method calls on Android
19+
- NoSuchMethodError for outcome methods on Android
1720
- Completion check for the Copy Android plugin to Assets setup step
1821

1922
## [5.0.0-beta.3]

OneSignalExample/Assets/OneSignal/Example/OneSignalExampleBehaviour.cs

+1-5
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public class OneSignalExampleBehaviour : MonoBehaviour {
135135
/// </summary>
136136
private void Start() {
137137
// Enable lines below to debug issues with OneSignal
138-
OneSignal.Debug.LogLevel = LogLevel.Verbose;
138+
OneSignal.Debug.LogLevel = LogLevel.Info;
139139
OneSignal.Debug.AlertLevel = LogLevel.Fatal;
140140

141141
_log($"Initializing with appId <b>{appId}</b>");
@@ -230,16 +230,12 @@ public void ToggleConsentGiven() {
230230
public void SetLogLevel() {
231231
var newLevel = _nextEnum(OneSignal.Debug.LogLevel);
232232
_log($"Setting LogLevel to <b>{newLevel}</b>");
233-
234-
// LogLevel uses the standard Unity LogType
235233
OneSignal.Debug.LogLevel = newLevel;
236234
}
237235

238236
public void SetAlertLevel() {
239237
var newLevel = _nextEnum(OneSignal.Debug.AlertLevel);
240238
_log($"Setting AlertLevel to <b>{newLevel}</b>");
241-
242-
// AlertLevel uses the standard Unity LogType
243239
OneSignal.Debug.AlertLevel = newLevel;
244240
}
245241

com.onesignal.unity.core/Samples~/OneSignalExampleBehaviour.cs

-4
Original file line numberDiff line numberDiff line change
@@ -230,16 +230,12 @@ public void ToggleConsentGiven() {
230230
public void SetLogLevel() {
231231
var newLevel = _nextEnum(OneSignal.Debug.LogLevel);
232232
_log($"Setting LogLevel to <b>{newLevel}</b>");
233-
234-
// LogLevel uses the standard Unity LogType
235233
OneSignal.Debug.LogLevel = newLevel;
236234
}
237235

238236
public void SetAlertLevel() {
239237
var newLevel = _nextEnum(OneSignal.Debug.AlertLevel);
240238
_log($"Setting AlertLevel to <b>{newLevel}</b>");
241-
242-
// AlertLevel uses the standard Unity LogType
243239
OneSignal.Debug.AlertLevel = newLevel;
244240
}
245241

com.onesignal.unity.ios/Runtime/Plugins/iOS/OneSignalUnityBridgeUser.mm

+3-2
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ - (void)onPushSubscriptionDidChangeWithState:(OSPushSubscriptionChangedState*)st
8080

8181
/*
8282
* Bridge methods
83+
* We use strdup because Unity attempts to free the memory after we return the value
8384
*/
8485

8586
extern "C" {
@@ -156,11 +157,11 @@ void _userRemoveTags(const char* tagsJson) {
156157
}
157158

158159
const char* _pushSubscriptionGetId() {
159-
return [OneSignal.User.pushSubscription.id UTF8String];
160+
return strdup([OneSignal.User.pushSubscription.id UTF8String]);
160161
}
161162

162163
const char* _pushSubscriptionGetToken() {
163-
return [OneSignal.User.pushSubscription.token UTF8String];
164+
return strdup([OneSignal.User.pushSubscription.token UTF8String]);
164165
}
165166

166167
bool _pushSubscriptionGetOptedIn() {

0 commit comments

Comments
 (0)