From 61921830a2ef7c13e59493e0c2c91210c174203d Mon Sep 17 00:00:00 2001 From: June P Date: Fri, 27 Dec 2024 00:27:52 +0900 Subject: [PATCH 1/3] something i don't know --- Sources/CAltSign/Apple API/ALTAppleAPI.m | 10 ++++++ .../CAltSign/Capabilities/ALTCapabilities.m | 32 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/Sources/CAltSign/Apple API/ALTAppleAPI.m b/Sources/CAltSign/Apple API/ALTAppleAPI.m index f196d74..87e66f0 100644 --- a/Sources/CAltSign/Apple API/ALTAppleAPI.m +++ b/Sources/CAltSign/Apple API/ALTAppleAPI.m @@ -428,6 +428,16 @@ - (void)updateAppID:(ALTAppID *)appID team:(ALTTeam *)team session:(ALTAppleAPIS parameters[feature] = appID.features[feature]; } + if (team.type == ALTTeamTypeFree) + for (int i = 0; i < appID.entitlements.count; i++) + { + ALTEntitlement *entitlement = appID.entitlements[i]; + if (!ALTFreeDeveloperCanUseEntitlement(entitlement)) + { + // remove entitlement from appID.entitlements + [appID.entitlements removeObjectAtIndex:i]; + } + } // parameters[@"capabilities"] = @[ALTCapabilityIncreasedMemoryLimit, ALTCapabilityIncreasedDebuggingMemoryLimit, ALTCapabilityExtendedVirtualAddressing]; [parameters setObject:appID.entitlements forKey:@"entitlements"]; diff --git a/Sources/CAltSign/Capabilities/ALTCapabilities.m b/Sources/CAltSign/Capabilities/ALTCapabilities.m index 057ac12..6ddbfcc 100644 --- a/Sources/CAltSign/Capabilities/ALTCapabilities.m +++ b/Sources/CAltSign/Capabilities/ALTCapabilities.m @@ -43,6 +43,38 @@ _Nullable ALTEntitlement ALTEntitlementForFeature(ALTFeature feature) return nil; } +bool ALTFreeDeveloperCanUseEntitlement(ALTEntitlement entitlement) { + if ([entitlement isEqualToString:ALTEntitlementAppGroups]) + { + return true; + } + else if ([entitlement isEqualToString:ALTEntitlementInterAppAudio]) + { + return true; + } + else if ([entitlement isEqualToString:ALTEntitlementGetTaskAllow]) + { + return true; + } + else if ([entitlement isEqualToString:ALTEntitlementIncreasedMemoryLimit]) + { + return true; + } + else if ([entitlement isEqualToString:ALTEntitlementTeamIdentifier]) + { + return true; + } + else if ([entitlement isEqualToString:ALTEntitlementKeychainAccessGroups]) + { + return true; + } + else if ([entitlement isEqualToString:ALTEntitlementApplicationIdentifier]) + { + return true; + } + return true; +} + _Nullable ALTFeature ALTFeatureForEntitlement(ALTEntitlement entitlement) { if ([entitlement isEqualToString:ALTEntitlementAppGroups]) From 9cb216cc4d1f31e20dbe2717a03780b4c4ac5da0 Mon Sep 17 00:00:00 2001 From: June Park Date: Fri, 27 Dec 2024 13:26:04 +0900 Subject: [PATCH 2/3] Update ALTCapabilities.h Signed-off-by: June Park --- Sources/CAltSign/Capabilities/ALTCapabilities.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/CAltSign/Capabilities/ALTCapabilities.h b/Sources/CAltSign/Capabilities/ALTCapabilities.h index 6aca1f6..76b9e9c 100644 --- a/Sources/CAltSign/Capabilities/ALTCapabilities.h +++ b/Sources/CAltSign/Capabilities/ALTCapabilities.h @@ -36,5 +36,6 @@ extern ALTFeature const ALTFeatureInterAppAudio; _Nullable ALTEntitlement ALTEntitlementForFeature(ALTFeature feature) NS_SWIFT_NAME(ALTEntitlement.init(feature:)); _Nullable ALTFeature ALTFeatureForEntitlement(ALTEntitlement entitlement) NS_SWIFT_NAME(ALTFeature.init(entitlement:)); +bool ALTFreeDeveloperCanUseEntitlement(ALTEntitlement entitlement); NS_ASSUME_NONNULL_END From 88d6c2d84e9ce25a4e680d571ad57e6a10b266cd Mon Sep 17 00:00:00 2001 From: June Date: Fri, 27 Dec 2024 13:36:06 +0900 Subject: [PATCH 3/3] fix the errors from previous commits --- Sources/CAltSign/Apple API/ALTAppleAPI.m | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Sources/CAltSign/Apple API/ALTAppleAPI.m b/Sources/CAltSign/Apple API/ALTAppleAPI.m index 87e66f0..e522576 100644 --- a/Sources/CAltSign/Apple API/ALTAppleAPI.m +++ b/Sources/CAltSign/Apple API/ALTAppleAPI.m @@ -427,20 +427,21 @@ - (void)updateAppID:(ALTAppID *)appID team:(ALTTeam *)team session:(ALTAppleAPIS { parameters[feature] = appID.features[feature]; } + + NSMutableDictionary *entitlementss = [appID.entitlements mutableCopy]; - if (team.type == ALTTeamTypeFree) - for (int i = 0; i < appID.entitlements.count; i++) + if (team.type == ALTTeamTypeFree) { + for (ALTEntitlement entitlement in appID.entitlements) { - ALTEntitlement *entitlement = appID.entitlements[i]; if (!ALTFreeDeveloperCanUseEntitlement(entitlement)) { - // remove entitlement from appID.entitlements - [appID.entitlements removeObjectAtIndex:i]; + [entitlementss removeObjectForKey:entitlement]; } } + } // parameters[@"capabilities"] = @[ALTCapabilityIncreasedMemoryLimit, ALTCapabilityIncreasedDebuggingMemoryLimit, ALTCapabilityExtendedVirtualAddressing]; - [parameters setObject:appID.entitlements forKey:@"entitlements"]; + [parameters setObject:entitlementss forKey:@"entitlements"]; [self sendRequestWithURL:URL additionalParameters:parameters session:session team:team completionHandler:^(NSDictionary *responseDictionary, NSError *requestError) { if (responseDictionary == nil)