gpt4 book ai didi

objective-c - Objective-C编译器错误

转载 作者:行者123 更新时间:2023-12-02 11:13:49 26 4
gpt4 key购买 nike

需要有关[currentValue,targetValue,差异]的帮助;线。它说初始化器元素不是编译时元素。请发布解决方案。

NSString *message = [NSString stringWithFormat:
@"The value of the slider is: %d\nThe target value is: %d\nThe difference is: %d",
[currentValue, targetValue, difference];
UIAlertView *alertView = [[UIAlertView alloc]]
initWithTitle:@"Hello, World!"
message:message
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];

最佳答案

应该:

NSString *message = [NSString stringWithFormat: @"The value of the slider is: %d\nThe target value is: %d\nThedifference is: %d", currentValue, targetValue, difference];

UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Hello, World!"
message:message
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];

您在UIAlertView分配之后有一个额外的'[',在当前之前一个额外的']'。

关于objective-c - Objective-C编译器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16474297/

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