dillidon/alerts-and-pickers

Example build error in Xcode10, together with crash

Opened this issue ยท 1 comments

Build Error:

location:

Alert&Pickers/Source/Extensions/String+Extension.swift

line 16:

return String(self[Range(start ..< end)])

Xcode said

Cannot invoke initializer for type 'Range<_>' with an argument list of type '(Range<String.Index>)'

After I modified it to the following code, the error disappeared.

let range = Range.init(uncheckedBounds: (lower: start, upper: end))    
return String(self[range])

App Crash:

When clicking Contacts Picker:

Alert&Pickers/Source/Extensions/String+Extension.swift // line 15
Thread 1: Fatal error: Can't advance past endIndex

***** 2018-07-19 02:15:39 +0000 ViewController.swift (line: 413) :: collectionView(_:didSelectItemAt:) :: selected alert - Country Picker

***** 2018-07-19 02:15:41 +0000 LocalePickerViewController.swift (line: 104) :: deinit :: has deinitialized

***** 2018-07-19 02:15:44 +0000 ViewController.swift (line: 413) :: collectionView(_:didSelectItemAt:) :: selected alert - Contacts Picker

***** 2018-07-19 02:15:44 +0000 ContactsPickerViewController.swift (line: 152) :: checkStatus(completionHandler:) :: status = CNAuthorizationStatus
hstdt commented

return String(self[Range(start ..< end)])
===ใ€‹
return String(self[(start ..< end)])