Unity 2023.1.19 iOS 17.4.1 iPhone 13
I wanted to make a note here regarding my recent experience.
When Archiving and pushing the app to TestFlight this issue did not come up.
When I connected my device to Xcode and played to do more testing I had this issue come up:
request = [[SKProductsRequest alloc] initWithProductIdentifiers: productIds]; thread 1: EXC_BAD_ACCESS (code=1, address=0x3dbfaecc0) Block implicitly retains ‘self’; explicitly mention ‘self’ to indicate this is intended behavior
Xcode did offer fix’s for the code in question.
I went through the code and there was a fix option which resulted in the code below and the app was able to play to my device.
Before code Fix’s:
// Execute a product metadata retrieval request via GCD.
- (void)initiateProductPoll:(int)delayInSeconds
{
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void) {
UnityPurchasingLog(@“Requesting product data…”);
request = [[SKProductsRequest alloc] initWithProductIdentifiers: productIds];
request.delegate = self;
[request start];
});
}
After Code Fix’s
- (void)initiateProductPoll:(int)delayInSeconds
{
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void) {
UnityPurchasingLog(@“Requesting product data…”);
self->request = [[SKProductsRequest alloc] initWithProductIdentifiers: self->productIds];
self->request.delegate = self;
[self->request start];
});
}