Ios 对于';GAI交易';
我正在尝试使用Google Analytics在iOS中实施应用内购买跟踪,但我收到以下错误: 取自Google Analytics页面的确切示例代码有2个错误:Ios 对于';GAI交易';,ios,objective-c,google-analytics,in-app-purchase,tracking,Ios,Objective C,Google Analytics,In App Purchase,Tracking,我正在尝试使用Google Analytics在iOS中实施应用内购买跟踪,但我收到以下错误: 取自Google Analytics页面的确切示例代码有2个错误: - (void)onPurchaseCompleted { GAITransaction *transaction = [GAITransaction transactionWithId:@"0_123456" // (NSString) Transaction ID, should be unique.
- (void)onPurchaseCompleted {
GAITransaction *transaction =
[GAITransaction transactionWithId:@"0_123456" // (NSString) Transaction ID, should be unique.
withAffiliation:@"In-App Store"; // (NSString) Affiliation
当我在上面编译时,上面写着要插入的“]”
transaction.taxMicros = (int64_t)(0.17 * 1000000); // (int64_t) Total tax (in micros)
transaction.shippingMicros = (int64_t)(0); // (int64_t) Total shipping (in micros)
transaction.revenueMicros = (int64_t)(2.16 * 1000000); // (int64_t) Total revenue (in micros)
下面我得到了一个错误:“没有“GAITransaction”的可见接口声明选择器“AddItemWithKu:name:category:priceMicros:quantity”
这里怎么了?错误1:是的,粘贴的代码末尾没有方括号,请将其添加到分号之前,错误将消失 错误2: “GaitTransaction”没有可见接口声明选择器 'addItemWithSKU:name:category:priceMicros:quantity'
[transaction addItemWithSKU:@"L_789" // (NSString) Product SKU
name:@"Level Pack: Space" // (NSString) Product name
category:@"Game expansions" // (NSString) Product category
priceMicros:(int64_t)(1.99 * 1000000) // (int64_t) Product price (in micros)
quantity:1]; // (NSInteger) Product quantity
[[GAI sharedInstance].defaultTracker sendTransaction:transaction]; // Send the transaction.
}
这意味着您的
事务
实例不响应addItemWithSKU:name:category:priceMicros:quantity
方法。您是否导入了所需的文件?您的.h文件中是否有additemWithku:name:category:priceMicros:quantity
方法签名?我想您没有使用最新的文档