Swift数组在iPhone 5s模拟器中提供exc_bad_access

时间:2015-01-02 00:23:34

标签: iphone arrays swift ios-simulator exc-bad-access

以下代码行仅在iOS 5s上运行时才会在iOS项目中出现运行时错误

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

将代码放在源代码中的位置并不重要,它总会发生。我的其他项目可以很好地模拟iPhone 5s。我不知道它为什么会发生,但我想它是某种错误。这是堆栈跟踪:

#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 ()

任何帮助都将不胜感激。

0 个答案:

没有答案