lldb error: variable not available

前端 未结 3 485
旧时难觅i
旧时难觅i 2020-12-14 01:12

Here are my two lines of code:

NSString *frontFilePath = [[NSBundle mainBundle] pathForResource:[self.bookendFileNames objectAtIndex:self.randomIndex] ofType         


        
3条回答
  •  暖寄归人
    2020-12-14 01:48

    In Swift, possibly starting with Xcode 9 and still an issue in Xcode 10, this could even come up when code optimization is turned off in the build settings. As @carlos_ms has pointed out here, a temporary solution is to define the variable as mutable, i.e.

    Turn

    let foo = Bar().string
    

    into

    var foo = Bar().string
    

    in order to cause optimization to skip on this variable. Note that this might not work in all instances.

    In this case, a good ol' debugPrint() might help you out.

提交回复
热议问题