我的iOS应用程序大小在app store上相当大。如何降低app thinning以使应用程序大小降低。
Note
-
应用程序切片是currently not working,直到另行通知。目前,减少应用规模的唯一方法是减少.ipa中包含的资产数量。
您可以尝试使用On Demand Resources,如果它们对您的应用程序有意义。
从昨天开始搜索app thinning,bitcode和on demand app资源,现在我调试所有这些东西,并在我的示例项目的帮助下分享我从美丽的apple documentation获得的知识。
应用程序细化概念涵盖bit code和按需资源。我将在下面详细讨论按需资源: -
iOS中的按需资源: - 在需要时访问images / videos / .h / .m / swift文件(Yes, on-demand resouring include source code files also
)。
Resource tags
设置。Tag
。它将显示在仅按需下载。现在是编码部分(my favourite site): -
NSBundleResourceRequest *resourceRequest;
#pragma mark - On demand resource
-(void)getOnDemandResource{
NSSet *setOfTag = [NSSet setWithObjects:@"chair", nil];
resourceRequest = [[NSBundleResourceRequest alloc]initWithTags:setOfTag];
[resourceRequest conditionallyBeginAccessingResourcesWithCompletionHandler:^(BOOL resourcesAvailable) {
if (!resourcesAvailable) {
// resourceRequest.loadingPriority = 1;//set the downloading priority (0 - 1) , NSBundleResourceRequestLoadingPriorityUrgent
[resourceRequest beginAccessingResourcesWithCompletionHandler:^(NSError * _Nullable error) {
if (error) {
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Error" message:error.debugDescription preferredStyle:UIAlertControllerStyleAlert];
[self presentViewController:alert animated:YES completion:nil];
}else{
//// The associated resources are loaded
}
}];
}else{
// The associated resources are available
}
}];
}
在不使用时结束访问点播资源(通常在游戏级别更改时)
#pragma mark - Remove access to on demand
-(void)endAccessToOnDemandResource{
[resourceRequest endAccessingResources];
}
qazxsw poi别忘了qazxsw poi。
NOTE:-
请不要担心这个项目中的autolayout。我主要关注需求资源/应用程序的事情。
摘要: - 因此我们可以使用上述技术通过enable On_Demand_Resources in build setting实现EXAMPLE PROJECT:- I create a sample project and uploaded here:- [http://www.dropbox.com/s/edi5zj68a4wuguh/WebOnTab.zip?dl=0][6]
。还请看一下app thinning
,它也描述了on-demand resourcing
,official documentation of resourceRequests(tracking progress
)。
据我所知,App变薄,这一切都是由Apple完成的。它会查看目标设备是什么,所需的图像和内容将自动提供给用户。
如果你想获得更薄的应用程序,也许重构是你应该看的主题。