2016-06-11 11 views
6

Gdy uruchamiam moją aplikację Swift w Xcode 7.3.1 (ze standardowym kompilatorem Swift 2) i wykonywanie zatrzymuje się w punkcie przerwania, Nie mogę sprawdzić zmiennych za pomocą polecenia po. Przy pierwszym uruchomieniu po exists (exists jest nieopcjonalną zmienną Bool w bieżącym zakresie) otrzymuję długi komunikat o błędzie (patrz poniżej). Po drugim uruchomieniu tego samego polecenia otrzymuję komunikat o błędzie error loading helper function: (null).Nie można sprawdzić zmiennych za pomocą "po" w moim projekcie Swift 2 przy użyciu Xcode 7.3.1 - funkcja pomocnika ładowania błędów

Aplikacja jest kompilowana i uruchamiana na schemacie debugowania bez "optymalizacji przetwarzania po wdrożeniu" i optymalizacji Brak [-O0].

Zmienna zawartość pojawia się poprawnie na panelu zmiennych inspektorów Xcode.

Ten sam błąd pojawia się z po self lub dowolną inną zmienną działającą na urządzeniu i symulatorze iOS.

Jeśli uruchomię nowy, czysty projekt, debugowanie za pomocą po działa poprawnie.


W bieżącym zakresie:

var exists: Bool = self.canRemoveAttachmentForEpisode(episode) 
NSLog("Exists is now \(exists)") // Breakpoint is set here 

To co się dzieje w panelu debuggera:

po exists 
error loading helper function: <EXPR>:141:9: warning: '--' is deprecated: it will be removed in Swift 3 
     --maxItemCounter 
     ^~ 
         -= 1 
<EXPR>:237:14: warning: '++' is deprecated: it will be removed in Swift 3 
      i++ 
      ^~ 
       += 1 
<EXPR>:267:19: warning: 'init(start:end:)' is deprecated: it will be removed in Swift 3. Use the '..<' operator. 
     let rng = Range(start: si, end: ei.advancedBy(-1)) 
       ^
<EXPR>:280:9: warning: initialization of variable '$__lldb_error_result' was never used; consider replacing with assignment to '_' or removing it 
    var $__lldb_error_result = __lldb_tmp_error 
    ~~~~^~~~~~~~~~~~~~~~~~~~ 
    _ 
<EXPR>:89:41: error: 'CustomStringConvertible' is ambiguous for type lookup in this context 
        if let csc = (x as? CustomStringConvertible) { 
             ^~~~~~~~~~~~~~~~~~~~~~~ 
Swift.CustomStringConvertible:13:17: note: found this candidate 
public protocol CustomStringConvertible { 
       ^
Castamatic.CustomStringConvertible:1:17: note: found this candidate 
public protocol CustomStringConvertible { 
       ^
<EXPR>:101:41: error: 'CustomStringConvertible' is ambiguous for type lookup in this context 
        if let csc = (x as? CustomStringConvertible) { 
             ^~~~~~~~~~~~~~~~~~~~~~~ 
Swift.CustomStringConvertible:13:17: note: found this candidate 
public protocol CustomStringConvertible { 
       ^
Castamatic.CustomStringConvertible:1:17: note: found this candidate 
public protocol CustomStringConvertible { 
       ^


(lldb) 



(lldb) po exists 
error loading helper function: (null) 

(lldb) 

Odpowiedz

1

I rozwiązać problem. Problem został byłem redefinicji istniejącego protokołu:

protocol MyCustomStringConvertible {} 

extension MyCustomStringConvertible where Self: RawRepresentable, Self.RawValue == String { 
    .. 
} 

I nowo protokół CustomStringConvertible, a może Apple CustomStringConvertible nie istniał kiedy napisałem własną wersję. Prawdopodobnie protokół jest używany tylko przez po podczas debugowania, więc błąd nigdy nie pojawił się w środowisku wykonawczym.

Moja jedyna wątpliwość jest taka: czy kompilator nie powinien ostrzec mnie o przedefiniowaniu istniejącego protokołu?