gpt4 book ai didi

c++ - Objective-C++ 错误 : Expected unqualified-id

转载 作者:行者123 更新时间:2023-11-30 03:33:25 24 4
gpt4 key购买 nike

最近我检查了我的一个旧应用程序,当我停止使用它时,它仍然运行良好。但是,现在每次我定义 UIImage *new 时,我都会收到错误 Expected unqualified-id

方法如下:

- (void)endTorsoWithUIImageView:(UIImageView *)flipper andError:(NSError *)clothingManagerError {
currActiveCol.torsoCurrCol = (direction == 1)? currActiveCol.torsoCurrCol + 1 : currActiveCol.torsoCurrCol - 1;
[clothingManager notifyAboutMovementInSection:ECOSTorso inDirection:(direction == 1)? ECCDNext : ECCDPrevious];

if (direction == 1) {
if (currActiveCol.torsoCurrCol + 2 < [[clothingManager.sectionSetSizes objectAtIndex:0] intValue]) {
flipper = [[sectionMatrix objectAtIndex:0] objectAtIndex:(currActiveCol.torsoCurrCol + 2) % 4];
[flipper setHidden:YES];
[flipper setCenter:(direction == 1)? CGPointMake(self.view.bounds.size.width + self.outfitView.frame.size.width, flipper.center.y) : CGPointMake(0 - self.outfitView.frame.size.width, flipper.center.y)];
[flipper setHidden:NO];

ECChangeDirection dir = (direction == 1)? ECCDNext : ECCDPrevious;
UIImage *new = [clothingManager updateAfterChangeInDirection:dir forSection:ECOSTorso withError:&clothingManagerError];
if (new != NULL) {
[flipper setImage:new];
[flipper setFrame:CGRectMake(flipper.frame.origin.x, flipper.frame.origin.y, flipper.frame.size.width, [self ratifierForImage:new])];
[self centerImageView:flipper forFocus:ASTorso takingLoctionIntoAccount:NO forLocation:0];
[[imageAssetCollection objectAtIndex:0] replaceObjectAtIndex:(currActiveCol.torsoCurrCol + 2) % 4
withObject:new];
} else {
// TODO: Report error to google analytics
}
}
} else if (direction == -1) {
if (currActiveCol.torsoCurrCol - 2 >= 0) {
flipper = [[sectionMatrix objectAtIndex:0] objectAtIndex:(currActiveCol.torsoCurrCol - 2) % 4];
[flipper setHidden:YES];
[flipper setCenter:(direction == 1)? CGPointMake(self.view.bounds.size.width + self.outfitView.frame.size.width, flipper.center.y) : CGPointMake(0 - self.outfitView.frame.size.width, flipper.center.y)];
[flipper setHidden:NO];

UIImage *new = (UIImage *)[clothingManager updateAfterChangeInDirection:(direction == 1)? ECCDNext : ECCDPrevious forSection:ECOSTorso withError:&clothingManagerError];
if (new != NULL) {
[flipper setImage:new];
[flipper setFrame:CGRectMake(flipper.frame.origin.x, flipper.frame.origin.y, flipper.frame.size.width, [self ratifierForImage:new])];
[self centerImageView:flipper forFocus:ASTorso takingLoctionIntoAccount:NO forLocation:0];
[[imageAssetCollection objectAtIndex:0] replaceObjectAtIndex:(currActiveCol.torsoCurrCol + 2) % 4
withObject:new];
} else {
// TODO: Report error to google analytics
}
}
}
}

方法定义如下- (UIImage * _Nullable)updateAfterChangeInDirection:(ECChangeDirection)direction forSection:(ECOutfitSection)ecos withError:(NSError * _Nullable * _Nullable)error;。该方法本身没有问题,如果不存在图像,则返回特定图像或 NULL。

我真的迷路了,非常感谢任何提示。

最佳答案

不要使用 new 作为开头的变量名。并使用 nil 而不是 NULL 检查您的 UIImage

Look here for info on naming properties

关于c++ - Objective-C++ 错误 : Expected unqualified-id,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42940303/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com