dillidon / alerts-and-pickers

Advanced usage of UIAlertController and pickers based on it: Telegram, Contacts, Location, PhotoLibrary, Country, Phone Code, Currency, Date...
MIT License
5.66k stars 698 forks source link

Example build error in Xcode10, together with crash #48

Open iWeslie opened 6 years ago

iWeslie commented 6 years ago

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)'

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 6 years ago

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