LoginSignup
10
10

More than 5 years have passed since last update.

xcode デバッグ時に変数の値を変更する、とメソッドの実行

Last updated at Posted at 2014-10-05

デバッグ時に変数の値を変更する方法です。

intなどの非オブジェクトの値を変更する

-(void)func {
  int tag = 1;  
  if( tag == 0 ) {          // ここでブレークポイント
  ...
}
(lldb) p tag = 0

オブジェクトの値を変更する

-(void)func {
  NSString* str = @"original message"
  [self.label setText:str]; // ここにブレークポイント
}
(lldb) po str = @"debug message"
(lldb) po str = @"デバッグ" // Unicodeは、直接代入できないっぽい。恐らくエスケープシーケンスが必要.

メソッドを呼び出す

-(void)func {
  NSString* str = @"original message"
  [self.label setText:str]; // ここにブレークポイント
}
(lldb) po [self.label setFrame:CGRectMake(0, 0, 100, 200)]
10
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
10