【问题标题】:xcode doesn't show all numbers that I type in debug areaxcode 不显示我在调试区域中输入的所有数字
【发布时间】:2012-09-25 17:57:16
【问题描述】:

当我在调试区域键入时,我的 Xcode(4.5 版)只显示第一个数字(或字符) - 像这样:


2012-09-26 02:45:31.560 nn[731:303] Which numbers do you want to calculate Great Common Divisor? 

 1st=

4

2012-09-26 02:45:36.777 nn[731:303] 2nd=

6

2012-09-26 02:45:39.633 nn[731:303] your number is 45 and 66, and gcd is 3

这有什么问题?

虽然程序运行良好,但当我更改输出选项(所有输出、目标输出)时,我可以看到我的号码。

这里是代码。


#import <Foundation/Foundation.h>

int main (int argc, char *argv[]){
@autoreleasepool{
    int n1, n2;
    int numerator, denominator, remainder, gcd;
    numerator = 0;
    denominator = 0;
    remainder = 0;
    gcd = 0;

    NSLog(@"Which numbers do you want to calculate Great Common Divisor? \n 1st=");
    scanf("%i", &n1);
    NSLog(@"2nd=");
    scanf("%i", &n2);

    numerator = n1;
    denominator = n2;

    while (numerator % denominator != 0){
        remainder = numerator % denominator;
        numerator = denominator;
        denominator = remainder;
    }

    gcd = denominator;
    NSLog(@"your number is %i and %i, and gcd is %i", n1, n2, gcd);
}
return 0;
}

注意:这个问题是突然出现的(我以前可以看到我输入的内容)。我检查了我所有的 mac,所有的 xcode 都是这样工作的。它们都只显示数字(或字符)的第一位。

【问题讨论】:

  • 感谢您的回复。我在上面添加了代码。

标签: xcode terminal


【解决方案1】:

我的 iMac 上也发生了同样的事情,而 Xcode 在我的 MacBook 上的调试模式下运行良好。我认为这是设置 Xcode 首选项的问题。不过,我不知道你是否知道,但苹果已经解决了这个问题。您可以找到更多信息:

https://developer.apple.com/library/mac/#releasenotes/DeveloperTools/RN-Xcode/_index.html

【讨论】:

    【解决方案2】:

    很酷,毫无疑问,您发现了新 Xcode 调试窗口的错误。代码很好,如果您在标准控制台中运行编译后的程序,它会按预期工作。

    您应该将错误报告到Apple Bug Reporter 网站,如果您不这样做,我会这样做...

    【讨论】:

    • 你有同样的问题吗?你的 xcode 的调试区也只显示一位数?
    • 非常感谢!我终于放心了。我们都可以向 Apple 报告这个问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多