diff --git a/RootHelper/main.m b/RootHelper/main.m index d06d27aa..1a01b3c3 100644 --- a/RootHelper/main.m +++ b/RootHelper/main.m @@ -244,6 +244,10 @@ void setTSURLSchemeState(BOOL newState, NSString* customAppPath) } } +NSArray *getCurrentPlatforms(void) +{ + return infoDictionaryForAppPath(trollStoreAppPath())[@"CFBundleSupportedPlatforms"]; +} #ifdef TROLLSTORE_LITE BOOL isLdidInstalled(void) @@ -864,6 +868,7 @@ void applyPatchesToInfoDictionary(NSString* appPath) // 174: // 180: tried to sign app where the main binary is encrypted // 184: tried to sign app where an additional binary is encrypted +// 186: application is for the wrong platform int installApp(NSString* appPackagePath, BOOL sign, BOOL force, BOOL isTSUpdate, BOOL useInstalldMethod, BOOL skipUICache) { @@ -883,6 +888,23 @@ int installApp(NSString* appPackagePath, BOOL sign, BOOL force, BOOL isTSUpdate, } if(!infoDictionaryForAppPath(appBundleToInstallPath)) return 172; + + NSArray* currentPlatforms = getCurrentPlatforms(); + NSArray* supportedPlatforms = infoDictionaryForAppPath(appBundleToInstallPath)[@"CFBundleSupportedPlatforms"]; + + BOOL platformMatch = NO; + for (NSString *platform in supportedPlatforms) + { + if ([currentPlatforms containsObject:platform]) + { + platformMatch = YES; + break; + } + } + + if (!platformMatch) return 186; + + // if (![supportedPlatforms containsObject:@"iPhoneOS"]) return 186; if(!isTSUpdate) { diff --git a/TrollStore/TSApplicationsManager.m b/TrollStore/TSApplicationsManager.m index f873e377..6cb86268 100644 --- a/TrollStore/TSApplicationsManager.m +++ b/TrollStore/TSApplicationsManager.m @@ -91,6 +91,10 @@ - (NSError*)errorForCode:(int)code break; case 185: errorDescription = @"Failed to sign the app. The CoreTrust bypass returned a non zero status code."; + break; + case 186: + errorDescription = @"The app you tried to install is not supported on this platform. The installation has been prevented as this application will not launch at all if it were to be installed."; + break; } NSError* error = [NSError errorWithDomain:TrollStoreErrorDomain code:code userInfo:@{NSLocalizedDescriptionKey : errorDescription}]; @@ -193,4 +197,4 @@ - (int)changeAppRegistration:(NSString*)appPath toState:(NSString*)newState return spawnRoot(rootHelperPath(), @[@"modify-registration", appPath, newState], nil, nil); } -@end \ No newline at end of file +@end diff --git a/TrollStore/TSSettingsListController.m b/TrollStore/TSSettingsListController.m index 3a04a424..ab82e629 100644 --- a/TrollStore/TSSettingsListController.m +++ b/TrollStore/TSSettingsListController.m @@ -125,7 +125,7 @@ - (NSMutableArray*)specifiers utilitiesDescription = @"Apps will be registered as User by default since AppSync Unified is installed.\n\n"; } else { - utilitiesDescription = @"Apps will be registered as System by default since AppSync Unified is not installed. When apps loose their System registration and stop working, press \"Refresh App Registrations\" here to fix them.\n\n"; + utilitiesDescription = @"Apps will be registered as System by default since AppSync Unified is not installed. When apps lose their System registration and stop working, press \"Refresh App Registrations\" here to fix them.\n\n"; } #endif utilitiesDescription = [utilitiesDescription stringByAppendingString:@"If an app does not immediately appear after installation, respring here and it should appear afterwards."]; @@ -626,4 +626,4 @@ - (NSMutableArray*)argsForUninstallingTrollStore return args; } -@end \ No newline at end of file +@end