Starting a SKProductsRequest gives -[_NSCFArray length] invalid selector error a moment later. LoadMicroPaymentsProductsOperation error

徘徊边缘 提交于 2019-12-25 04:44:17

问题


I'm fetching a list of identifiers from my server, then passing them off in a products request to Apple. Here's my code, and below is the error I'm getting. The iPhone 4 is not crashing when this happens.

-(void)didReceiveData:(NSArray *)data {
NSLog(@"Received Identifiers: %@",data);
NSSet *productIdentifiers = [NSSet setWithArray:data];
SKProductsRequest *productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiers]; 
productsRequest.delegate = self;
[productsRequest start];
NSLog(@"productsRequest should have started by now");
}


  Wed Dec 29 09:42:14 iPhone XXXX-iphone[6363] <Warning>: Received Identifiers: (
        (
        1,
        10,
        "com.XXXX.XXXX.10"
    )
)


 Wed Dec 29 09:42:14 iPhone XXXX-iphone[6363] <Warning>: productsRequest should have started by now

Wed Dec 29 09:42:18 iPhone itunesstored[6367] : -[__NSCFArray length]: unrecognized selector sent to instance 0x119070

Wed Dec 29 09:42:18 iPhone itunesstored[6367] : caught -[__NSCFArray length]: unrecognized selector sent to instance 0x119070 exception with stack trace: (0x33ac0975 0x3347b49d 0x33ac2133 0x33a69aa9 0x33a69860 0x2717b 0x27515 0x31469651 0x314693ed 0x31469e39 0x3362795f 0x336276c3 0x3363c4eb 0x33c32680 0x33c32ba0 0x33bd7251 0x33bcf978)


回答1:


From your log output, I guess data is an array of arrays.

You should pass only an array of NSString (your product ids) to setWithArray:



来源:https://stackoverflow.com/questions/4555552/starting-a-skproductsrequest-gives-nscfarray-length-invalid-selector-error-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!