jeudi 1 janvier 2015

Swift arrays giving exc_bad_access in iPhone 5s simulator

The following lines of code will give a runtime error in my iOS project only when running on iPhone 5s



var test = Array<Int>();
test.append(4);


It doesn't matter where the code is put in the source code, it will always happen. My other projects simulate it fine for iPhone 5s. I have no idea why it's happening but I imagine it's some sort of bug. Here's the stack trace:



#0 0x000000010ed6dc34 in __swift_memcpy8_8 ()
#1 0x000000010ec2c403 in Swift._ContiguousArrayBuffer._uninitializedCopy <A>(Swift._ContiguousArrayBuffer<A>)(Swift.Range<Swift.Int>, target : Swift.UnsafeMutablePointer<A>) -> Swift.UnsafeMutablePointer<A> ()
#2 0x000000010ec28732 in Swift._ArrayBuffer._uninitializedCopy <A>(Swift._ArrayBuffer<A>)(Swift.Range<Swift.Int>, target : Swift.UnsafeMutablePointer<A>) -> Swift.UnsafeMutablePointer<A> ()
#3 0x000000010ec50404 in Swift._arrayOutOfPlaceUpdate <A : Swift._ArrayBufferType, B : Swift._PointerFunctionType>(inout A, inout Swift.Optional<Swift._ContiguousArrayBuffer<B.Element>>, Swift.Int, Swift.Int, B) -> () ()
#4 0x000000010ec39c37 in Swift._arrayAppend <A : Swift._ArrayBufferType>(inout A, A.Element) -> () ()
#5 0x000000010ec2187c in Swift.Array.append <A>(inout Swift.Array<A>)(A) -> () ()
#6 0x000000010c8e4de0 in SpriteWalkthrough.AppDelegate.application (SpriteWalkthrough.AppDelegate)(ObjectiveC.UIApplication, didFinishLaunchingWithOptions : Swift.Optional<Swift.Dictionary<ObjectiveC.NSObject, Swift.AnyObject>>) -> Swift.Bool at /Users/x/Desktop/SpriteWalkthrough/SpriteWalkthrough/AppDelegate.swift:21
#7 0x000000010c8e5090 in @objc SpriteWalkthrough.AppDelegate.application (SpriteWalkthrough.AppDelegate)(ObjectiveC.UIApplication, didFinishLaunchingWithOptions : Swift.Optional<Swift.Dictionary<ObjectiveC.NSObject, Swift.AnyObject>>) -> Swift.Bool ()
#8 0x000000010d747475 in -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] ()
#9 0x000000010d747fbc in -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] ()
#10 0x000000010d74ad2c in -[UIApplication _runWithMainScene:transitionContext:completion:] ()
#11 0x000000010d749bf2 in -[UIApplication workspaceDidEndTransaction:] ()
#12 0x00000001142e12a3 in __31-[FBSSerialQueue performAsync:]_block_invoke ()
#13 0x000000010c9fd53c in __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ ()
#14 0x000000010c9f3285 in __CFRunLoopDoBlocks ()
#15 0x000000010c9f3045 in __CFRunLoopRun ()
#16 0x000000010c9f2486 in CFRunLoopRunSpecific ()
#17 0x000000010d749669 in -[UIApplication _run] ()
#18 0x000000010d74c420 in UIApplicationMain ()
#19 0x000000010c8e55ce in top_level_code at /Users/x/Desktop/SpriteWalkthrough/SpriteWalkthrough/AppDelegate.swift:12
#20 0x000000010c8e560a in main ()
#21 0x000000010f1f0145 in start ()


Any help would be appreciated.




Aucun commentaire:

Enregistrer un commentaire