Skip to content

Commit 01e898d

Browse files
committed
Corrected token sanitisation code
1 parent b631b86 commit 01e898d

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

Swift Push/AppDelegate.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
7373

7474

7575
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken:Data) {
76-
var token: String = deviceToken.description
77-
token = token.replacingOccurrences(of: "[^0-9 ]", with: "")
78-
76+
let characterSet: CharacterSet = CharacterSet( charactersIn: "<>" )
77+
let token: String = ( deviceToken.description as NSString )
78+
.trimmingCharacters( in: characterSet )
79+
.replacingOccurrences(of: " ", with: "" )
80+
7981
print("device token is \(token)")
8082
UserDefaults.standard().set(token as String, forKey:"deviceToken")
8183
UserDefaults.standard().synchronize()

Swift Push/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>448</string>
22+
<string>452</string>
2323
<key>LSRequiresIPhoneOS</key>
2424
<true/>
2525
<key>UIBackgroundModes</key>

Swift Push/Settings.bundle/Root.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<array>
77
<dict>
88
<key>DefaultValue</key>
9-
<integer>448</integer>
9+
<integer>452</integer>
1010
<key>Key</key>
1111
<string>maximumRecords</string>
1212
<key>MaximumValue</key>

0 commit comments

Comments
 (0)