From fac83d5c0fdb9b10bae09903b909e03bac19c8cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=AF=E7=87=95=E8=BE=89?= Date: Thu, 22 Mar 2018 00:39:37 +0800 Subject: [PATCH] fix issue that appirater can't get Localized string from Appirater.bundle when integrated by framework --- Appirater.m | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Appirater.m b/Appirater.m index 01a2b493..f8609fea 100644 --- a/Appirater.m +++ b/Appirater.m @@ -162,13 +162,13 @@ + (NSBundle *)bundle bundle = [NSBundle mainBundle]; } else { NSURL *appiraterBundleURL = [[NSBundle mainBundle] URLForResource:@"Appirater" withExtension:@"bundle"]; - - if (appiraterBundleURL) { - // Appirater.bundle will likely only exist when used via CocoaPods - bundle = [NSBundle bundleWithURL:appiraterBundleURL]; - } else { - bundle = [NSBundle mainBundle]; + NSError *err; + if (![appiraterBundleURL checkResourceIsReachableAndReturnError:&err]) { + // integrate appirater by framwork in swift project + appiraterBundleURL = [[NSBundle bundleForClass:[Appirater class]] URLForResource:@"Appirater" withExtension:@"bundle"]; } + // Appirater.bundle will likely only exist when used via CocoaPods + bundle = [NSBundle bundleWithURL:appiraterBundleURL]; } return bundle;