After upgrade to Xcode Version 10.2 (10E125),Fatal error when using range.upperBound.samePosition(in: utf16)How to convert Range<String.Index> to NSRange?Codesign error: Provisioning profile cannot be found after deleting expired profileVersion vs build in Xcodexcode-select active developer directory errorSwift: decodeObjectForKey crashes if key doesn't existGetting error “No such module” using Xcode, but the framework is thereXcode error “Could not find Developer Disk Image”Xcode 7 error: “Missing iOS Distribution signing identity for …”fatal error: Array index out of range when trying to get to locationSwift: EXC_BAD_INSTRUCTION called when calling functionHow to create a summation function and call it, by passing Int array in swift playground?

Can a country avoid prosecution for crimes against humanity by denying it happened?

Would you recommend a keyboard for beginners with or without lights in keys for learning?

Did the US Climate Reference Network Show No New Warming Since 2005 in the US?

IEEE Registration Authority mac prefix

Which is the best password hashing algorithm in .NET Core?

Why do we need explainable AI?

Is there any reason to change the ISO manually?

First Number to Contain Each Letter

How could it be that the capo isn't changing the pitch?

Main differences between 5th edition Druid and 3.5 edition Druid

What does "se jouer" mean here?

How can I oppose my advisor granting gift authorship to a collaborator?

Are language and thought the same?

What did Boris Johnson mean when he said "extra 34 billion going into the NHS"

How to generate all 3×3 matrices with a,a,a,a,b,b,b,c,c?

To which airspace does the border of two adjacent airspaces belong to?

What would a biological creature need in order to see the future?

When is it legal to castle moving the rook first?

Is Levitate supposed to basically disable a melee based enemy?

What's the difference between a share and a stock?

Why did the VIC-II and SID use 6 µm technology in the era of 3 µm and 1.5 µm?

In-universe, why does Doc Brown program the time machine to go to 1955?

How to anonymously report the Establishment Clause being broken?

Travel to USA with a stuffed puppet



After upgrade to Xcode Version 10.2 (10E125),Fatal error when using range.upperBound.samePosition(in: utf16)


How to convert Range<String.Index> to NSRange?Codesign error: Provisioning profile cannot be found after deleting expired profileVersion vs build in Xcodexcode-select active developer directory errorSwift: decodeObjectForKey crashes if key doesn't existGetting error “No such module” using Xcode, but the framework is thereXcode error “Could not find Developer Disk Image”Xcode 7 error: “Missing iOS Distribution signing identity for …”fatal error: Array index out of range when trying to get to locationSwift: EXC_BAD_INSTRUCTION called when calling functionHow to create a summation function and call it, by passing Int array in swift playground?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















After upgrade to Xcode Version 10.2 (10E125),
progress Fatal error at range.upperBound.samePosition(in: utf16)



extension String 

//Range => NSRange
func nsRange(from range: Range<String.Index>) -> NSRange
guard let to = range.upperBound.samePosition(in: utf16) else
return NSMakeRange(0, 0)


guard let from = range.lowerBound.samePosition(in: utf16) else
return NSMakeRange(0, 0)


return NSMakeRange(utf16.distance(from: utf16.startIndex, to: from), utf16.distance(from: from, to: to))


//NSRange =>Range
func range(from range: NSRange) -> Range<String.Index>?
guard let from16 = utf16.index(utf16.startIndex, offsetBy: range.location, limitedBy: utf16.endIndex) else return nil
guard let to16 = utf16.index(from16, offsetBy: range.length, limitedBy: utf16.endIndex) else return nil
guard let from = String.Index(from16, within: self) else return nil
guard let to = String.Index(to16, within: self) else return nil
return from ..< to




it start crash in




range.upperBound.samePosition(in: utf16)




error




Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)




I expect good running



image: [1]: https://i.stack.imgur.com/bfbbf.png










share|improve this question





















  • 1





    Where does utf16 come from?

    – El Tomato
    Mar 28 at 3:12











  • Possible duplicate of How to convert Range<String.Index> to NSRange?

    – El Tomato
    Mar 28 at 3:12











  • I use this code in extension of String, so utf16 possible is self.utf16, I did see there answer,it run good before Xcode 10.2, but After upgrade to Xcode Version 10.2 (10E125), progress Fatal error

    – PengZishang
    Mar 28 at 3:28






  • 2





    But you don’t need any of your code, because string conversion between range and NSRange is now built in

    – matt
    Mar 28 at 3:38











  • thanks a lot ,conversion between range and NSRange already built in after swift4

    – PengZishang
    Mar 28 at 4:26

















0















After upgrade to Xcode Version 10.2 (10E125),
progress Fatal error at range.upperBound.samePosition(in: utf16)



extension String 

//Range => NSRange
func nsRange(from range: Range<String.Index>) -> NSRange
guard let to = range.upperBound.samePosition(in: utf16) else
return NSMakeRange(0, 0)


guard let from = range.lowerBound.samePosition(in: utf16) else
return NSMakeRange(0, 0)


return NSMakeRange(utf16.distance(from: utf16.startIndex, to: from), utf16.distance(from: from, to: to))


//NSRange =>Range
func range(from range: NSRange) -> Range<String.Index>?
guard let from16 = utf16.index(utf16.startIndex, offsetBy: range.location, limitedBy: utf16.endIndex) else return nil
guard let to16 = utf16.index(from16, offsetBy: range.length, limitedBy: utf16.endIndex) else return nil
guard let from = String.Index(from16, within: self) else return nil
guard let to = String.Index(to16, within: self) else return nil
return from ..< to




it start crash in




range.upperBound.samePosition(in: utf16)




error




Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)




I expect good running



image: [1]: https://i.stack.imgur.com/bfbbf.png










share|improve this question





















  • 1





    Where does utf16 come from?

    – El Tomato
    Mar 28 at 3:12











  • Possible duplicate of How to convert Range<String.Index> to NSRange?

    – El Tomato
    Mar 28 at 3:12











  • I use this code in extension of String, so utf16 possible is self.utf16, I did see there answer,it run good before Xcode 10.2, but After upgrade to Xcode Version 10.2 (10E125), progress Fatal error

    – PengZishang
    Mar 28 at 3:28






  • 2





    But you don’t need any of your code, because string conversion between range and NSRange is now built in

    – matt
    Mar 28 at 3:38











  • thanks a lot ,conversion between range and NSRange already built in after swift4

    – PengZishang
    Mar 28 at 4:26













0












0








0


1






After upgrade to Xcode Version 10.2 (10E125),
progress Fatal error at range.upperBound.samePosition(in: utf16)



extension String 

//Range => NSRange
func nsRange(from range: Range<String.Index>) -> NSRange
guard let to = range.upperBound.samePosition(in: utf16) else
return NSMakeRange(0, 0)


guard let from = range.lowerBound.samePosition(in: utf16) else
return NSMakeRange(0, 0)


return NSMakeRange(utf16.distance(from: utf16.startIndex, to: from), utf16.distance(from: from, to: to))


//NSRange =>Range
func range(from range: NSRange) -> Range<String.Index>?
guard let from16 = utf16.index(utf16.startIndex, offsetBy: range.location, limitedBy: utf16.endIndex) else return nil
guard let to16 = utf16.index(from16, offsetBy: range.length, limitedBy: utf16.endIndex) else return nil
guard let from = String.Index(from16, within: self) else return nil
guard let to = String.Index(to16, within: self) else return nil
return from ..< to




it start crash in




range.upperBound.samePosition(in: utf16)




error




Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)




I expect good running



image: [1]: https://i.stack.imgur.com/bfbbf.png










share|improve this question
















After upgrade to Xcode Version 10.2 (10E125),
progress Fatal error at range.upperBound.samePosition(in: utf16)



extension String 

//Range => NSRange
func nsRange(from range: Range<String.Index>) -> NSRange
guard let to = range.upperBound.samePosition(in: utf16) else
return NSMakeRange(0, 0)


guard let from = range.lowerBound.samePosition(in: utf16) else
return NSMakeRange(0, 0)


return NSMakeRange(utf16.distance(from: utf16.startIndex, to: from), utf16.distance(from: from, to: to))


//NSRange =>Range
func range(from range: NSRange) -> Range<String.Index>?
guard let from16 = utf16.index(utf16.startIndex, offsetBy: range.location, limitedBy: utf16.endIndex) else return nil
guard let to16 = utf16.index(from16, offsetBy: range.length, limitedBy: utf16.endIndex) else return nil
guard let from = String.Index(from16, within: self) else return nil
guard let to = String.Index(to16, within: self) else return nil
return from ..< to




it start crash in




range.upperBound.samePosition(in: utf16)




error




Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)




I expect good running



image: [1]: https://i.stack.imgur.com/bfbbf.png







ios swift xcode swift5






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 28 at 23:51









Bhaumik

9131 gold badge6 silver badges17 bronze badges




9131 gold badge6 silver badges17 bronze badges










asked Mar 28 at 3:08









PengZishangPengZishang

12 bronze badges




12 bronze badges










  • 1





    Where does utf16 come from?

    – El Tomato
    Mar 28 at 3:12











  • Possible duplicate of How to convert Range<String.Index> to NSRange?

    – El Tomato
    Mar 28 at 3:12











  • I use this code in extension of String, so utf16 possible is self.utf16, I did see there answer,it run good before Xcode 10.2, but After upgrade to Xcode Version 10.2 (10E125), progress Fatal error

    – PengZishang
    Mar 28 at 3:28






  • 2





    But you don’t need any of your code, because string conversion between range and NSRange is now built in

    – matt
    Mar 28 at 3:38











  • thanks a lot ,conversion between range and NSRange already built in after swift4

    – PengZishang
    Mar 28 at 4:26












  • 1





    Where does utf16 come from?

    – El Tomato
    Mar 28 at 3:12











  • Possible duplicate of How to convert Range<String.Index> to NSRange?

    – El Tomato
    Mar 28 at 3:12











  • I use this code in extension of String, so utf16 possible is self.utf16, I did see there answer,it run good before Xcode 10.2, but After upgrade to Xcode Version 10.2 (10E125), progress Fatal error

    – PengZishang
    Mar 28 at 3:28






  • 2





    But you don’t need any of your code, because string conversion between range and NSRange is now built in

    – matt
    Mar 28 at 3:38











  • thanks a lot ,conversion between range and NSRange already built in after swift4

    – PengZishang
    Mar 28 at 4:26







1




1





Where does utf16 come from?

– El Tomato
Mar 28 at 3:12





Where does utf16 come from?

– El Tomato
Mar 28 at 3:12













Possible duplicate of How to convert Range<String.Index> to NSRange?

– El Tomato
Mar 28 at 3:12





Possible duplicate of How to convert Range<String.Index> to NSRange?

– El Tomato
Mar 28 at 3:12













I use this code in extension of String, so utf16 possible is self.utf16, I did see there answer,it run good before Xcode 10.2, but After upgrade to Xcode Version 10.2 (10E125), progress Fatal error

– PengZishang
Mar 28 at 3:28





I use this code in extension of String, so utf16 possible is self.utf16, I did see there answer,it run good before Xcode 10.2, but After upgrade to Xcode Version 10.2 (10E125), progress Fatal error

– PengZishang
Mar 28 at 3:28




2




2





But you don’t need any of your code, because string conversion between range and NSRange is now built in

– matt
Mar 28 at 3:38





But you don’t need any of your code, because string conversion between range and NSRange is now built in

– matt
Mar 28 at 3:38













thanks a lot ,conversion between range and NSRange already built in after swift4

– PengZishang
Mar 28 at 4:26





thanks a lot ,conversion between range and NSRange already built in after swift4

– PengZishang
Mar 28 at 4:26












0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55389583%2fafter-upgrade-to-xcode-version-10-2-10e125-fatal-error-when-using-range-upperb%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55389583%2fafter-upgrade-to-xcode-version-10-2-10e125-fatal-error-when-using-range-upperb%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript