C++ 目标-C++;错误:应为非限定id
最近我检查了我的一个旧应用程序,当我停止工作时,它仍然可以正常工作。但是现在,每次我定义C++ 目标-C++;错误:应为非限定id,c++,ios,objective-c,uiimage,objective-c++,C++,Ios,Objective C,Uiimage,Objective C++,最近我检查了我的一个旧应用程序,当我停止工作时,它仍然可以正常工作。但是现在,每次我定义UIImage*new时,我都会得到错误预期的非限定id 方法如下: - (void)endTorsoWithUIImageView:(UIImageView *)flipper andError:(NSError *)clothingManagerError { currActiveCol.torsoCurrCol = (direction == 1)? currActiveCol.torsoCur
UIImage*new
时,我都会得到错误预期的非限定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
}
}
}
}
-(无效)endTorsoWithUIImageView:(UIImageView*)翻转器和错误:(N错误*)ClothingManager错误{
currActiveCol.torsoCurrCol=(方向==1)?currActiveCol.torsoCurrCol+1:currActiveCol.torsoCurrCol-1;
[clothingManager NotifyaboutMovementInstation:ECOSTorso间接:(方向==1)?ECCDNext:ECCDREVIOUS];
如果(方向==1){
if(currActiveCol.torsoCurrCol+2<[[clothingManager.sectionSetSizes objectAtIndex:0]intValue]){
flipper=[[sectionMatrix objectAtIndex:0]objectAtIndex:(currActiveCol.torsoCurrCol+2)%4];
[翻转设置隐藏:是];
[flipper setCenter:(方向==1)?CGPointMake(self.view.bounds.size.width+self.oughtView.frame.size.width,flipper.center.y):CGPointMake(0-self.oughtView.frame.size.width,flipper.center.y)];
[翻转设置隐藏:否];
ECChangeDirection dir=(方向==1)?ECCDNext:ECCDREVIOUS;
UIImage*new=[clothingManager updateAfterChangeInDirection:dir for Section:ECOSTorso withError:&clothingManager错误];
如果(新!=NULL){
[翻转器设置图像:新];
[flipper setFrame:CGRectMake(flipper.frame.origin.x,flipper.frame.origin.y,flipper.frame.size.width,[self-ApprovierForImage:new]);
[self-centerImageView:flipper for Focus:ASTorso TakingLocation帐户:NO for Location:0];
[[imageAssetCollection对象索引:0]替换对象索引:(currActiveCol.torsoCurrCol+2)%4
withObject:新];
}否则{
//TODO:向google analytics报告错误
}
}
}否则如果(方向==-1){
如果(currActiveCol.torsoCurrCol-2>=0){
flipper=[[sectionMatrix对象索引:0]对象索引:(currActiveCol.torsoCurrCol-2)%4];
[翻转设置隐藏:是];
[flipper setCenter:(方向==1)?CGPointMake(self.view.bounds.size.width+self.oughtView.frame.size.width,flipper.center.y):CGPointMake(0-self.oughtView.frame.size.width,flipper.center.y)];
[翻转设置隐藏:否];
UIImage*new=(UIImage*)[clothingManager更新AfterChangeIndirection:(方向==1)?ECCDNext:ECCDREVIOUS forSection:ECOSTorso withError:&clothingManager错误];
如果(新!=NULL){
[翻转器设置图像:新];
[flipper setFrame:CGRectMake(flipper.frame.origin.x,flipper.frame.origin.y,flipper.frame.size.width,[self-ApprovierForImage:new]);
[self-centerImageView:flipper for Focus:ASTorso TakingLocation帐户:NO for Location:0];
[[imageAssetCollection对象索引:0]替换对象索引:(currActiveCol.torsoCurrCol+2)%4
withObject:新];
}否则{
//TODO:向google analytics报告错误
}
}
}
}
方法定义如下:-(UIImage*\u Nullable)updateAfterChangeInDirection:(ECChangeDirection)direction:(ECOutfitSection)ecos withError:(NSError*\u Nullable*\u Nullable)error代码>。方法本身没有返回特定映像的问题,如果不存在映像,则返回NULL
我真的迷路了,非常感谢你给我的建议。不要用new
作为变量名。然后用nil
检查UIImage
,而不是NULL
不要以“new”作为变量名开头。并用nil检查UIImage,而不是NULL。就这样!非常感谢你!如果您将其添加为答案,我会将其标记为答案,我很高兴它有帮助:)