【发布时间】:2015-07-30 20:47:12
【问题描述】:
我收到一个错误,因为“文字和标识符之外不允许使用非 ASCII 字符”。下面是代码:
- (void)purchaseMyProduct:(SKProduct *)product {
if ([self canMakePurchases]) {
SKPayment *payment = [SKPayment paymentWithProduct:product];
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
[[SKPaymentQueue defaultQueue] addPayment:payment];
}
else{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle: @"Purchases are disabled in your device" message:nil delegate: self cancelButtonTitle:@"Ok" otherButtonTitles: nil];
[alertView show];
}
}
我在 else 块 上收到此错误。我试过删除空格,但没有奏效。我哪里错了?
【问题讨论】:
-
我看不出该代码有什么问题。
-
清理你的构建。产品->干净
-
也可以试试
View > Text > Show Control Characters看看源文件中是否有奇怪的东西。 -
@Nikita:我尝试过“干净”的方法,但没有奏效
-
您是否尝试过接受 Xcode 提供的 Fix-it?
标签: ios objective-c identifier literals non-ascii-characters