Skip to content

Commit

Permalink
Merge pull request #538 from qonversion/bundleIssueFix
Browse files Browse the repository at this point in the history
FIxed bundle fetching logic
  • Loading branch information
suriksarkisyan authored Sep 9, 2024
2 parents 1cc9971 + fcb5bf2 commit a4487d2
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Sources/Qonversion/Qonversion/Utils/QNUserInfo/QNUserInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ + (NSDictionary *)overallData {
}

+ (nullable NSString *)appStoreReceipt {
NSURL *receiptURL = QNUserInfo.bundle.appStoreReceiptURL;
NSURL *tempReceiptURL = QNUserInfo.bundle.appStoreReceiptURL;
NSURL *receiptURL = tempReceiptURL ?: [NSBundle mainBundle].appStoreReceiptURL;

if (!receiptURL) {
return @"";
Expand All @@ -95,8 +96,15 @@ + (BOOL)isDebug {
}

+ (nullable NSBundle *)bundle {
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"appStoreReceiptURL != nil"];
return [NSBundle.allBundles filteredArrayUsingPredicate:predicate].firstObject;
NSArray *allBundles = [[NSBundle allBundles] copy];

for (NSBundle *bundle in allBundles) {
if (bundle.appStoreReceiptURL != nil) {
return bundle;
}
}

return nil;
}

@end

0 comments on commit a4487d2

Please sign in to comment.