2016-08-14 3 views
1

이상한 오류 with Xcode 7.3.1 (7D1014)분할 오류 11 7.3.1

0 swift     0x000000010d05766b llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 43 
1 swift     0x000000010d056956 llvm::sys::RunSignalHandlers() + 70 
2 swift     0x000000010d057ccf SignalHandler(int) + 287 
3 libsystem_platform.dylib 0x00007fff91a3f52a _sigtramp + 26 
4 libsystem_platform.dylib 0x000000010e1c5000 _sigtramp + 2088262384 
5 swift     0x000000010b08fd11 swift::SILPassManager::runModulePass(swift::SILModuleTransform*) + 1025 
6 swift     0x000000010b09053e swift::SILPassManager::runOneIteration() + 686 
7 swift     0x000000010b09660e swift::runSILOptimizationPasses(swift::SILModule&) + 462 
8 swift     0x000000010adaa579 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&) + 13193 
9 swift     0x000000010ada668d frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2781 
10 swift     0x000000010ada20ac main + 1932 
11 libdyld.dylib   0x00007fff8ff745ad start + 1 



1. While running SILModuleTransform "Closure Specialization". 
Command failed due to signal: Segmentation fault: 11 

오류가있는 파일 프로세스 Archive에서 다음과 같은 수 있도록 저를 도와주는 다음 tabBarController.swift

입니다 tab Bar 버튼을 클릭하면 스크롤 뷰가 위로 이동합니다.

import UIKit 

class tapBarController: UITabBarController, UITabBarControllerDelegate { 

    /// Determines whether the scrolling capability's enabled. 
    var scrollEnabled: Bool = true 

    private var previousIndex = 0 

    override func viewDidLoad() { 
     super.viewDidLoad() 

     delegate = self 
    } 

    /* 
    Always call "super" if you're overriding this method in your subclass. 
    */ 
    func tabBarController(tabBarController: UITabBarController, didSelectViewController viewController: UIViewController) { 

     guard scrollEnabled else { 
      return 
     } 

     guard let index = viewControllers?.indexOf(viewController) else { 
      return 
     } 

     if index == previousIndex { 
      var scrollViews = [UIScrollView]() 

      dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), { [weak self]() in 

       self?.iterateThroughSubviews(self?.view) { (scrollView) in 
        scrollViews.append(scrollView) 
       } 

       guard let scrollView = scrollViews.first else { 
        return 
       } 

       dispatch_async(dispatch_get_main_queue(), { 
        scrollView.setContentOffset(CGPointZero, animated: true) 
       }) 
       }) 
     } 

     previousIndex = index 
    } 

    /* 
    Iterates through the view hierarchy in an attempt to locate a UIScrollView with "scrollsToTop" enabled. 
    Since the functionality relies on "scrollsToTop", it plugs easily into existing architectures - you can 
    control the behaviour by modifying "scrollsToTop" on your UIScrollViews. 
    */ 
    private func iterateThroughSubviews(parentView: UIView?, onRecognition: (UIScrollView) -> Void) { 
     guard let view = parentView else { 
      return 
     } 

     for subview in view.subviews { 
      if let scrollView = subview as? UIScrollView where scrollView.scrollsToTop == true { 
       onRecognition(scrollView) 
      } 

      iterateThroughSubviews(subview, onRecognition: onRecognition) 
     } 
    } 
} 

홀 파일에 주석을 첨부하면 오류가 없습니다. 또한 코드에서 오류 (2 일 전까지 작업 중이었고 보관 된 오류)를 파악할 수 없습니다.

내 iPhone 및 시뮬레이터에서 완벽하게 작동합니다. 아이디어가 있으십니까?

답변

0
import UIKit 

/// A UITabBarController subclass that allows "scroll-to-top" gestures via tapping tab bar items. You enable the functionality by simply subclassing. 
class tapBarController: UITabBarController, UITabBarControllerDelegate { 

/// Determines whether the scrolling capability's enabled. 
var scrollEnabled: Bool = true 

private var previousIndex = 0 

override func viewDidLoad() { 
    super.viewDidLoad() 

    delegate = self 
} 

/* 
Always call "super" if you're overriding this method in your subclass. 
*/ 
func tabBarController(tabBarController: UITabBarController, didSelectViewController viewController: UIViewController) { 
    guard scrollEnabled else { 
     return 
    } 

    guard let index = viewControllers?.indexOf(viewController) else { 
     return 
    } 

    if index == previousIndex { 

     dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), { [weak self]() in 

      guard let scrollView = self?.iterateThroughSubviews(self?.view) else { 
       return 
      } 

      dispatch_async(dispatch_get_main_queue(), { 
       scrollView.setContentOffset(CGPointZero, animated: true) 
      }) 
      }) 
    } 

    previousIndex = index 
} 

/* 
Iterates through the view hierarchy in an attempt to locate a UIScrollView with "scrollsToTop" enabled. 
Since the functionality relies on "scrollsToTop", it plugs easily into existing architectures - you can 
control the behaviour by modifying "scrollsToTop" on your UIScrollViews. 
*/ 
private func iterateThroughSubviews(parentView: UIView?) -> UIScrollView? { 
    guard let view = parentView else { 
     return nil 
    } 

    for subview in view.subviews { 
     if let scrollView = subview as? UIScrollView where scrollView.scrollsToTop == true { 
      return scrollView 
     } 

     if let scrollView = iterateThroughSubviews(subview) { 
      return scrollView 
     } 
    } 

    return nil 
} 
} 

이 코드로 대체하여 작동했습니다.