Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CTTelephonyNetworkInfo should not be released #13

Closed
andrewagain opened this issue Oct 29, 2014 · 2 comments
Closed

CTTelephonyNetworkInfo should not be released #13

andrewagain opened this issue Oct 29, 2014 · 2 comments

Comments

@andrewagain
Copy link

I experienced a crash similar to this one in the TestFlight SDK http://stackoverflow.com/questions/14238586/coretelephony-crash

The TestFlight SDK had an issue with CoreTelephony. They resolved it by keeping a reference to CTTelephonyNetworkInfo throughout the life of the application. (static variable or property of a class instance that you keep around forever).

I think Amplitude should keep a reference to CTTelephonyNetworkInfo and not release it.

Also see TestFlight 2.0 change notes: https://github.com/spenrose/TestFlight-SDK/blob/master/release_notes.md

Thread : Crashed: com.apple.main-thread
0  libobjc.A.dylib                0x000000019533bbd0 objc_msgSend + 16
1  CoreTelephony                  0x000000018557ca58 _ServerConnectionCallback(__CTServerConnection*, __CFString const*, __CFDictionary const*, void*) + 52
2  CoreTelephony                  0x0000000185591030 ___ZNK13CTServerState21sendNotification_syncE7CTEventPK10__CFStringPK14__CFDictionary_block_invoke14 + 32
3  CoreFoundation                 0x0000000184ba1fd4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 28
4  CoreFoundation                 0x0000000184ba1c84 __CFRunLoopDoTimer + 888
5  CoreFoundation                 0x0000000184b9f6d0 __CFRunLoopRun + 1372
6  CoreFoundation                 0x0000000184acd1f4 CFRunLoopRunSpecific + 396
7  GraphicsServices               0x000000018dc5b5a4 GSEventRunModal + 168
8  UIKit                          0x00000001893fe784 UIApplicationMain + 1488
9  Status                         0x0000000100081780 main (main.m:16)
10 libdyld.dylib                  0x0000000195996a08 start + 4
@curtisliu
Copy link
Member

Thanks for letting us know! The changes in 5155539 and 27e9e11 should keep the reference.

@fabb
Copy link

fabb commented Dec 12, 2016

But when keeping the reference, there is another bug: after the app goes to background and gets active again, the currentRadioAccessTechnology is nil - until the connection speed changes again.

bguidolim added a commit to marmelroy/PhoneNumberKit that referenced this issue May 4, 2022
…e issues (#521)

* Keeping a single reference of CTTelephonyNetworkInfo to avoid possible issues

This commit fix #444

Resources:
 - #484
 - https://stackoverflow.com/questions/14238586/coretelephony-crash
 - flurry/flurry-ios-sdk#200
 - amplitude/Amplitude-iOS#13

* Keeping only the real changes

Co-authored-by: Bruno Guidolim <bruno@pockid.com>
elijahheineman added a commit to EverlongProject/PhoneNumberKit that referenced this issue May 9, 2023
* bump tvOS support to 10, fix build issues

* Remove duplicate methods

Fix the bug that NSRange may cross the boundary

When working with text that’s presented to the user, use the localizedCaseInsensitiveCompare(_:) method instead.

Remove duplicate calls `setup`.

* remove nil value from carrier cellular provider

* 🔗 Callable URL and call() method to call on a device

* Update RegexManager.swift

Memory leak fixed on Charset fix and tested please add to next release

* Update CountryCodePickerViewController.swift

* Metadata updates for release 8.12.43

* Xcode: Update last upgrade check

* PhoneNumber: remove call method due to build issue when included in app extension

* Regex manager: fix build error with special character set

* Release 3.3.4

* Update flag after pasting/auto-filling a phone number

* Fix Swift 5.6 crash on Linux (#516)

* Replace use of NSMutableCharacterSet with CharacterSet

This change fixes a crash when initializing PhoneNumberKit on Linux

* Use designated constant for non-breaking space

* Create stale.yml

* Updated the compile time check to work with other platforms (#435)

* Metadata update: 8.12.47 (#519)

* Metadata update: 8.12.47

* Updated tests

Co-authored-by: Bruno Guidolim <bruno@pockid.com>

* Release 3.3.5

* Update stale.yml

* Adds accessibility text to country code button, (#439)

Makes Search bar input more explicit

Co-authored-by: Rebecca Chin <rchin@league.com>

* Added modalPresentationStyle Property (#436)

* Added modalPresentationStyle Property

* Fixed optional type to modalPresentationStyle

* Fixed Sample Project

* Fix bundle accessor for SwiftUI previews. (#485)

* Release 3.3.6

* Fix bundle acessor (#523)

* Fix #522

* Let's play safe

Co-authored-by: Bruno Guidolim <bruno@pockid.com>

* Keeping a single reference of CTTelephonyNetworkInfo to avoid possible issues (#521)

* Keeping a single reference of CTTelephonyNetworkInfo to avoid possible issues

This commit fix #444

Resources:
 - marmelroy/PhoneNumberKit#484
 - https://stackoverflow.com/questions/14238586/coretelephony-crash
 - flurry/flurry-ios-sdk#200
 - amplitude/Amplitude-iOS#13

* Keeping only the real changes

Co-authored-by: Bruno Guidolim <bruno@pockid.com>

* Release 3.3.7

* Introduce coding strategies for `PhoneNumber` (#517)

* Release 3.4.0

* Makes RegexManager thread-safe (#529)

* Fix #528

* Apply suggestions from code review

Co-authored-by: Michael Williams <michaeldwilliams@users.noreply.github.com>

Co-authored-by: Michael Williams <michaeldwilliams@users.noreply.github.com>

* Release 3.4.1

* Fix bundle search path (#531)

* Updated metadata and related unit-tests according to the v8.12.50 in Google library. (#534)

Please note: With the new metadata the partial formatter can add extra characters (like `(`) in the beginning of the string detection, if the default region is `US`. The Unit test changes in the `PartialFormatterTests` are highlighting those edge cases.

* Fix #249: Potential thread explosion (#535)

* Fix #249: Potential thread explosion

* Applying suggestion from code review

* Release 3.4.2

* Simplified `defaultRegionCode()` in `PhoneNumberKit` in order to handle better the multiple SIM related issues. (#538)

- The `CoreTelephony` based solution was replaced with a `Contacts` framework based one.
- Added more strict performance tests for parsing both via an array,. and through a non-optimized way (calling the `parse(_:_:)` method in the body of a for loop).

* Updated metadata according to 8.12.51. (#537)

* Release 3.4.3

* Normalizes the way of getting metadata from MetadataManager (#542)

* Release 3.4.4

* Updated metadata according to v8.12.52 https://github.com/google/libphonenumber/releases/tag/v8.12.52 (#545)

* Release 3.4.5

* Fix #451 no flag change for different regionCode (#550)

* Falling back default region to Locale if CNContactsUserDefaults is not available (fix #549) (#551)

* Metadata automation (#554)

* Started script to automate releases

* Added GH action

* Updated metadata to version metadata/8.12.53 (#555)

Co-authored-by: runner <runner@Mac-1660824613252.local>

* Release 3.4.6

* Stop testing metadata since it's supposed to change.

* Updated metadata to version metadata/8.12.54 (#556)

Co-authored-by: runner <runner@Mac-1661155838180.local>

* Release 3.4.7

* Fix #557 (#561)

* Revert #550 due issues with other countries (#562)

* Make sample app use local package

* Revert "Fix #451 no flag change for different regionCode (#550)"

This reverts commit d8c0069.

* Release 3.4.8

* Updated metadata to version metadata/8.12.55 (#568)

Co-authored-by: runner <runner@Mac-1662768069832.local>

* Release 3.4.9

* Updated metadata to version metadata/8.12.56 (#572)

Co-authored-by: runner <runner@Mac-1663934197792.local>

* Change references to ISO 639 language code into ISO 3166 region code (#571)

* Update flags for countries with the same international code (#563)

Fix #451

* Release 3.4.10

* Updated metadata to version metadata/8.12.57 (#576)

Co-authored-by: runner <runner@Mac-1665748767715.local>

* Fix macCatalyst OS bug if language is set to Korean (#578)

* Fix minor "dispaly" typo (#580)

* Updated metadata to version metadata/8.13.0 (#582)

Co-authored-by: runner <runner@Mac-1667735953427.local>

* Make sample app use the local package

* Introducing the new error `ambiguousNumber` (#583)

ParseManager now throws an error with a list of possible phone numbers in case a number was not able to be parsed and the guessing logic provides multiple phone numbers.

* Release 3.5.0

* Updated metadata to version metadata/8.13.1 (#586)

Co-authored-by: runner <runner@Mac-1669635957015.local>

* Release 3.5.1

* Updated metadata to version metadata/8.13.2 (#589)

Co-authored-by: runner <runner@Mac-1670500125558.local>

* Release 3.5.2

* Updated metadata to version metadata/8.13.3 (#590)

Co-authored-by: runner <runner@Mac-1671752828078.local>

* Add Equatable conformance for PhoneNumberError (#591)

* Change references to ISO 639 language code into ISO 3166 region code

* Add documentation for PhoneNumberError.ambiguousNumber

* Add Equatable conformance for PhoneNumberError

* Release 3.5.3

* Add missing text field delegate method (#592)

* Updated metadata to version metadata/8.13.4 (#594)

Co-authored-by: runner <runner@Mac-1673265644046.local>

* Release 3.5.4

* Only change default region if the withFlag is true (#593)

* Fix country picker by id (#601)

* Release 3.5.5

* Revert "Fix country picker by id (#601)" (#603)

This reverts commit eddc377.

Co-authored-by: Bruno Guidolim <bruno@ruuky.com>

* Updated metadata to version metadata/8.13.5 (#604)

Co-authored-by: runner <runner@Mac-1675092228380.local>

* Release 3.5.6

* Updated metadata to version metadata/8.13.6 (#605)

* Increment Swift version (#606)

* Release 3.5.7

* Updated metadata to version metadata/8.13.7 (#608)

* ensure country codes are capitalized per ISO specs (#612)

* Release 3.5.8

* Updated metadata to version metadata/8.13.8 (#617)

* Updated metadata to version metadata/8.13.9 (#624)

* Alternate way to load contents of a file in a Data object (#620)

* Updated metadata to version metadata/8.13.10 (#631)

* Updated metadata to version metadata/8.13.11 (#636)

Co-authored-by: runner <runner@Mac-1682595728106.local>

* Release 3.5.9

---------

Co-authored-by: Nicolas Degen <ndegen@me.com>
Co-authored-by: fuyoufang <fuyoufang@163.com>
Co-authored-by: Kevin CATHALY <alaknorth@gmail.com>
Co-authored-by: Ben Myers <benl.myers01@gmail.com>
Co-authored-by: sachithamh <5784803+sachithamh@users.noreply.github.com>
Co-authored-by: Horevoi Illia <illia.horevoi@materialise.kiev.ua>
Co-authored-by: Roy Marmelstein <marmelroy@gmail.com>
Co-authored-by: Roy Marmelstein <marmelroy@spotify.com>
Co-authored-by: Alessandro Mulloni <ale@mulloni.tech>
Co-authored-by: Bruno Guidolim <bguidolim@gmail.com>
Co-authored-by: David Roman <d@vidroman.dev>
Co-authored-by: Bobby Rohweder <BobbyRohweder@gmail.com>
Co-authored-by: Bruno Guidolim <bruno@pockid.com>
Co-authored-by: Rebecca Chin <rebeccagchin@gmail.com>
Co-authored-by: Rebecca Chin <rchin@league.com>
Co-authored-by: Erkam Kücet <ekucet@gmail.com>
Co-authored-by: Luke Redpath <luke@lukeredpath.co.uk>
Co-authored-by: Michael Williams <michaeldwilliams@users.noreply.github.com>
Co-authored-by: vladislavsosiuk <vladislavsosiuk@gmail.com>
Co-authored-by: Peter Molnar <petermolnar.hu@gmail.com>
Co-authored-by: Max <14940890+MaxZheleznyy@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: runner <runner@Mac-1660824613252.local>
Co-authored-by: runner <runner@Mac-1661155838180.local>
Co-authored-by: runner <runner@Mac-1662768069832.local>
Co-authored-by: runner <runner@Mac-1663934197792.local>
Co-authored-by: Iggy Drougge <idrougge@mac.com>
Co-authored-by: runner <runner@Mac-1665748767715.local>
Co-authored-by: jackyabcde <49716044+jackyabcde@users.noreply.github.com>
Co-authored-by: Greg <greg@vida.com>
Co-authored-by: runner <runner@Mac-1667735953427.local>
Co-authored-by: runner <runner@Mac-1669635957015.local>
Co-authored-by: runner <runner@Mac-1670500125558.local>
Co-authored-by: runner <runner@Mac-1671752828078.local>
Co-authored-by: Anna Strzeżek <astrzezek@gmail.com>
Co-authored-by: runner <runner@Mac-1673265644046.local>
Co-authored-by: Olivier Destrebecq <olivier@mobdesignapps.fr>
Co-authored-by: 4taras4 <4taras4@gmail.com>
Co-authored-by: Bruno Guidolim <bruno@ruuky.com>
Co-authored-by: runner <runner@Mac-1675092228380.local>
Co-authored-by: Juantri94 <55553750+Juantri94@users.noreply.github.com>
Co-authored-by: Morgan Dock <mmdock@users.noreply.github.com>
Co-authored-by: runner <runner@Mac-1682595728106.local>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants