internal compiler error: Bus error

雨燕双飞 提交于 2020-01-05 09:05:21

问题


I have the following code (see below) and if I compile it as is i get "internal compiler error: Bus error". If I comment out the last ImageOne.transform, everything works fine. If the file ends in .m it compiles fine if I change it to .mm then it has an issue. Any ideas?

[UIView animateWithDuration:duration1 delay:delay options:UIViewAnimationCurveEaseIn animations:^{
            ImageOne.transform = CGAffineTransformMakeScale(scale1, scale1);
            ImageOne.alpha = 1.0f;

        } 
                         completion:^(BOOL finished){
                             [UIView animateWithDuration:SecondDuration delay:SecondDelay options:UIViewAnimationCurveEaseOut animations:^{
                                 ImageOne.transform = CGAffineTransformMakeScale(scale2, scale2);
                             }
                                              completion:^(BOOL finished){
                                                  [UIView animateWithDuration:SecondDuration delay:SecondDelay options:UIViewAnimationCurveEaseOut animations:^{
                                                      ImageOne.transform = CGAffineTransformMakeScale(scale1, scale1); //results in bus error, i think its due to nesting

                                                  }
                                                                   completion:nil];
                                              }];
                         }];
    }

回答1:


Why do you nest another block, rather than just adding

ImageOne.transform = CGAffineTransformMakeScale(scale1, scale1);

into the first block like so

completion:^(BOOL finished)
{
  [UIView animateWithDuration:SecondDuration delay:SecondDelay options:UIViewAnimationCurveEaseOut animations:^{
              ImageOne.transform = CGAffineTransformMakeScale(scale1, scale1);
              ImageOne.transform = CGAffineTransformMakeScale(scale2, scale2);

Hope this helps. :)



来源:https://stackoverflow.com/questions/5479451/internal-compiler-error-bus-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!