Commit 4237782
authored
Fix leak (#326)
* Refactored Networking Requests
* Instead of having to manually build an HTTP request every time the app needs to make a request with the backend, this commit simplifies the process by encapsulating all of this code in a few classes.
* Also fixes an issue with registerUser where location data was not being sent. The location data was being added to 'dataDic' after it got serialized into JSON data
* Fixed broken test
* Forgot to import appropriate headers breaking a test.
* Added NSURLSession attachment download code
* Closed the url_session branch since it is now obsolete
* Removed old header method declarations
* Due to the fact that we've switched to a new rest model, the old enqueueRequest:onSuccess... method is no longer needed and has been removed from the project
* Also removed the overrider for this method from unit test shadows
* PR Fixes, Adds correct copyright to header, fixes typos
* Fixes some typos
* Accesses OneSignalClient sharedClient using a property accessor instead of a method getter for cleaner syntax
* Moves JSON parser method to OneSignalClient class for logical consistency
* Removes unnecessary log statements
* Fixes Buttons for Push Notifications in iOS 7
* Fixes an issue iOS 7, buttons were not being shown on the UIAlertView when the app was in focus.
* Also fixes an issue where the button action ID wasn't being forwarded to the host application (via OSHandleNotificationActionBlock)
* Remove HTTP Client
* Minor commit to remove the OneSignalHTTPClient from the project since it is no longer used.
* Fixes a memory leak
* Resolves a memory leak introduced by creating NSURLSession instances and not calling [session finishTasksAndInvalidate]. The effect of this leak was relatively small since it only leaks 600 bytes per request, but it does add up over time.
* Shared NSURLSession Instance
* Switched OneSignalClient to use a single shared instance of NSURLSession instead of creating a new instance for every HTTP request.
* For the Extension image download function, added a function call in OneSignalHelper.m so that the NSURLSession instance is not leaked.
* App ID Requirement Fix
• Fixed an issue in this branch where the Get iOS Params request was displaying a 'missing App ID' error in the debug console.
• Added logging for verbose mode showing HTTP requests & parameters
• Made it so that requests that require an app ID yet are given a nil/empty app ID will return an NSError and log an error to the console.
* Fix Small Memory Leak
• Fixed a small memory leak in OneSignalLocation
• malloc() was being used to initialize a temporary location but free() was never called on it so it never got released
• Also, added a required CLLocationManager delegate method to prevent a crash in the event of a location manager error1 parent 3ff4462 commit 4237782
File tree
13 files changed
+70
-150
lines changed- iOS_SDK/OneSignalSDK
- OneSignal.xcodeproj
- Source
13 files changed
+70
-150
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | 50 | | |
55 | 51 | | |
56 | 52 | | |
| |||
214 | 210 | | |
215 | 211 | | |
216 | 212 | | |
217 | | - | |
218 | | - | |
219 | 213 | | |
220 | 214 | | |
221 | 215 | | |
| |||
407 | 401 | | |
408 | 402 | | |
409 | 403 | | |
410 | | - | |
411 | | - | |
412 | 404 | | |
413 | 405 | | |
414 | 406 | | |
| |||
522 | 514 | | |
523 | 515 | | |
524 | 516 | | |
525 | | - | |
526 | 517 | | |
527 | 518 | | |
528 | 519 | | |
| |||
684 | 675 | | |
685 | 676 | | |
686 | 677 | | |
687 | | - | |
688 | 678 | | |
689 | 679 | | |
690 | 680 | | |
| |||
720 | 710 | | |
721 | 711 | | |
722 | 712 | | |
723 | | - | |
724 | 713 | | |
725 | 714 | | |
726 | 715 | | |
| |||
757 | 746 | | |
758 | 747 | | |
759 | 748 | | |
760 | | - | |
761 | 749 | | |
762 | 750 | | |
763 | 751 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
| 100 | + | |
99 | 101 | | |
100 | 102 | | |
101 | 103 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
| |||
154 | 153 | | |
155 | 154 | | |
156 | 155 | | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | 156 | | |
167 | 157 | | |
168 | 158 | | |
| |||
293 | 283 | | |
294 | 284 | | |
295 | 285 | | |
296 | | - | |
297 | 286 | | |
298 | 287 | | |
299 | 288 | | |
| |||
Lines changed: 12 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
103 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
107 | 108 | | |
108 | | - | |
109 | | - | |
| 109 | + | |
110 | 110 | | |
111 | | - | |
112 | | - | |
113 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
114 | 114 | | |
115 | | - | |
| 115 | + | |
116 | 116 | | |
117 | | - | |
118 | | - | |
| 117 | + | |
119 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
120 | 122 | | |
121 | 123 | | |
122 | 124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
31 | 35 | | |
32 | 36 | | |
33 | 37 | | |
| |||
39 | 43 | | |
40 | 44 | | |
41 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
42 | 54 | | |
43 | | - | |
44 | | - | |
| 55 | + | |
| 56 | + | |
45 | 57 | | |
46 | 58 | | |
47 | 59 | | |
48 | | - | |
49 | | - | |
50 | | - | |
| 60 | + | |
51 | 61 | | |
52 | 62 | | |
53 | 63 | | |
54 | 64 | | |
55 | 65 | | |
56 | 66 | | |
57 | 67 | | |
58 | | - | |
59 | | - | |
| 68 | + | |
| 69 | + | |
60 | 70 | | |
61 | 71 | | |
62 | 72 | | |
63 | | - | |
64 | | - | |
65 | 73 | | |
66 | 74 | | |
67 | 75 | | |
68 | 76 | | |
69 | 77 | | |
70 | | - | |
| 78 | + | |
71 | 79 | | |
72 | 80 | | |
73 | 81 | | |
| |||
81 | 89 | | |
82 | 90 | | |
83 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
84 | 110 | | |
85 | 111 | | |
86 | 112 | | |
| |||
106 | 132 | | |
107 | 133 | | |
108 | 134 | | |
109 | | - | |
110 | | - | |
| 135 | + | |
111 | 136 | | |
112 | 137 | | |
113 | 138 | | |
| |||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
| 121 | + | |
120 | 122 | | |
121 | 123 | | |
122 | 124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | 31 | | |
33 | 32 | | |
34 | 33 | | |
| |||
219 | 218 | | |
220 | 219 | | |
221 | 220 | | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | 221 | | |
228 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
229 | 228 | | |
230 | 229 | | |
231 | 230 | | |
| |||
236 | 235 | | |
237 | 236 | | |
238 | 237 | | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
239 | 242 | | |
240 | 243 | | |
241 | 244 | | |
| |||
0 commit comments