Flutter huge app size in iOS compared with React Native original - flutter

I've recreated a simple app that was originally made in React Native with 5MB file size on the app store. The app has no images or anything of any particular size, but it does use Admob ads.
After uploading it to the app store the build is showing as 35MB...not sure what the reason is but it when opening the package contents of the build archive it seems that a bunch of dylib files in SwiftSupport/iphoneos are created that are very large. that's the biggest folder in the archive anyway. I think it has to do with the Pods folder created in order to use Admob.
I'm guessing it can never be as small as the React Native original app but surely it should not be seven times the size...is there some way to remove the SwiftSupport files or another way to shrink it?
EDIT: Also in the Runner project folder in the build archive in Frameworks there are loads of Swift dylib files in there too that are large. Really all the space is being taken up by these Swift support dylib files...
Just built the app for Android and it's 8.33MB so quite a difference there, even though both versions of course use Admob.

This isn't really related to Flutter. Every iOS app containing code that wants to support iOS 11 and lower, needs to contain additional flutter libraries.
You can disable this in Xcode by setting "Always Embed Swift Standard Libraries" to false, and raising the deployment target to iOS 12.
Example of my flutter app with respect to different deployment targets. There is no change in build setting but deployment target only. iOS 13 does not include swift libraries with the build.
iOS version -> App build size
10 -> 127.8 MB
11 -> 127.8 MB
12 -> 90.9 MB
13 -> 49.6 MB

I have two sources: first [1] is titled 'Flutter vs Swift' and second [2] 'How to enable swift support for existing project in flutter'. Reading the both we observe flutter and swift do not have to co-exist and observing the latter we can see how it is enabled with a flag when creating the IOS package. I would first check that IOS folder is created without swift reference.
Third link [3] shows that Admob usage can be done in dart only.
About size, I am not sure though if using dart and disabling Swift would 100% make the trick. Flutter vs Swift link [1] has a native Swift app and 'comparison' equal Flutter app and conclusion was the size of flutter app was doubled about that of Swift app. And sizes where around 20 and 50 MB respectively, Flutter being the biggest.
Edit
It shows up the Swift is part of the plugin / module you use and thus cannot be easily just removed. About the size, Flutter app is normally already bigger than app with Swift and now the solution combines the both. Rise in size is as espected.
[1] https://blog.codemagic.io/flutter-vs-swift/
[2] How to enable Swift support for existing project in flutter
[3] https://flutterawesome.com/easily-implement-ads-into-a-flutter-app/

Related

AppIcon does not appear on iPhone 5S iOS 11 with Xcode 9

I have a project with 5 Targets. All of these have their own .xcassets (Assets) that holds LaunchImages, AppIcons, And two more Image Assets. All of these .xcassets are given appropriate Target Membership (Properly added to Copy Bundle Resources of their own target. All of these .xcassets files have different names).
When deploying these apps on iPhone 5S, the AppIcon does not appear. I searched on google and came across this answer Missing CFBundleIconName in Xcode9 iOS11 app release. I made changes like removing CFBundleIcons and adding CFBundleIconName in my Info.plist file. But nothing seems to work.
I have also assigned AppStore iOS 1024x1024 in AppIcon for all .xcassets file.
I created ipa for AdHoc distribution and verified that appropriate AppIcon gets bundled in the archive (By extracting ipa and browsing through Payload). While distributing ipa with http://www.diawi.com the AppIcon is displayed on the device while the app is being installed (while circular progress is being shown on AppIcon on iPhone). But as the installation finishes, the AppIcon disappears.
I checked the same AdHoc build on iPhone 5 (iOS 10.x.x) and the AppIcon is displayed on it. So, what exactly is creating problem for iOS 11 on iPhone 5S.
Xcode shows AppIcon for each target and their scheme as :
My Xcode version is : Version 9.0 (9A235).Someone please confirm that I have latest stable release (not beta / GM seed).
My iPhone 5S is updated on iOS 11 via official release (I haven't installed beta of iOS 11).
Open your app icons in Preview. Go to Tools -> Assign Profile. Select sRGB IEC61966-2.1 from the dropdown. You will have to do this for all the app icons you are using for your app.
I finally found the problem with cocoapods. The shell-script located at 'Pods -> Target Support Files -> Pods-ProjectName -> Pods-ProjectName-resources.sh' contains a section (probably last) where it combines all asset catalogs into one, thus my exported archive would have assets from all the targets and results in unexpected AppIcon.
All I had to do was to remove the section in the shell script where asset catalogs were combined into one. Refer this answer if you are experiencing same issue.
What worked for me:
Go to 'TARGETS -> Build Settings' and set your icon name in 'Asset Catalog App Icon Set Name'.

Unity iOS build: app store size 4x ipa size

We are facing an issue with our new game download size on the store, we are using :
- Unity 5.0.2
- Xcode 7.0.1 (bitcode disabled)
After building the game with Unity and archiving it in xCode, if we export the archive to ipa ( Save for iOS App Store Deployment , without app symbols), the ipa size is 39.4MB, but when we submit the game to App Store (through xCode organizer directly, or using the Application Loader with the ipa), Testflight shows the game size to be 172.9 MB !!!! which is a huge problem, many players will not download the game because of that.
Any help will be much appreciated.
-Khaled
Testflight usually shows the size including symbols. Therefore it's important to mention that Testflight size != Appstore size. You can of course submit the symbols with your final Appstore submission as well, but this is not encountered for the download size limit. Apple adds some additional files to your submitted ipa but most importantly, it takes the binary and applies security measurements on the text segment which won't be compressed anymore afterwards and could increase the final size.
Anyway, you need to upgrade to a newer Unity Version, as 5.0.2 includes a quite outdated IL2CPP version which improved a lot in the last year. There is a guide on how to receive proper values and also some tips in the Unity forums about it.
http://forum.unity3d.com/threads/il2cpp-build-size-improvements.322079/
I solved this problem! Just move back to xcode 6.4 version! :)

Submitting apps to app store for iOS9

I have been trying to submit my app multiple times to the app store and I keep seeing this error:
Invalid Swift Support - The files libswiftPassKit.dylib,
libswiftCoreAudio.dylib, libswiftContacts.dylib,
libswiftCoreLocation.dylib, libswiftCoreMedia.dylib,
libswiftCoreData.dylib, libswiftAVFoundation.dylib don’t match
/Payload/MyApp.app/Frameworks/libswiftPassKit.dylib,
/Payload/MyApp.app/Frameworks/libswiftCoreAudio.dylib,
/Payload/MyApp.app/Frameworks/libswiftContacts.dylib,
/Payload/MyApp.app/Frameworks/libswiftCoreLocation.dylib,
/Payload/MyApp.app/Frameworks/libswiftCoreMedia.dylib,
/Payload/MyApp.app/Frameworks/libswiftCoreData.dylib,
/Payload/MyApp.app/Frameworks/libswiftAVFoundation.dylib. Make sure
the files are correct, rebuild your app, and resubmit it. Don’t apply
post-processing to
/Payload/MyApp.app/Frameworks/libswiftPassKit.dylib,
/Payload/MyApp.app/Frameworks/libswiftCoreAudio.dylib,
/Payload/MyApp.app/Frameworks/libswiftContacts.dylib,
/Payload/MyApp.app/Frameworks/libswiftCoreLocation.dylib,
/Payload/MyApp.app/Frameworks/libswiftCoreMedia.dylib,
/Payload/MyApp.app/Frameworks/libswiftCoreData.dylib,
/Payload/MyApp.app/Frameworks/libswiftAVFoundation.dylib.
Is there something else i'm doing wrong? Or is it still not available? I'm not able to find any resources to help with the above
Seems like it's an issue with Cocoapods. As per below:
https://github.com/CocoaPods/CocoaPods/issues/4188
The current latest version of Cocoapods is 0.39 beta 4 which does NOT work.
You can check your
Build Settings -> Embedded Content Contains Swift Code.
If it's NO,you can set it to YES,and then have a try.If it's not working.You can update your Mac system to Mac OS X 10.10.5 and your Xcode to Xcode 7,just rebuild your project with iOS 9,and then Xcode will tell you which you must deal with.

How to get multiple targets into one binary for app store submission?

I have split my iPhone app into two targets one for the ipad and one for the iphone. When I upload to the appstore I can only have one binary. But I have two targets?
I think I am missing a step. Thanks in advance for any help.
A "target" encompasses all of the instructions that Xcode uses to build your app.
You can have two targets inside of one binary, although this is not always done. This is how Universal Binaries are made. The two apps are bundled together inside of one binary. If you open up a Mac app "bundle" you will notice a few meta files, like icons and such, and there will be the actual compiled binary code. An iOS Universal Binary has both apps inside of it.
(If you watch your compilation carefully, you'll notice that Xcode actually builds your app twice. It does one build for iPhone/iPod and one for iPad.)
Provided that your Xcode project is set up properly, you will get the intended results.
The binary will be fine, the "targets" refer to what runs when it is run on an iPhone vs iPad. If the project is setup correctly for universal it should work fine.

Why does my XCode project include the wrong icon file for my iOS Application?

I am creating a lite version of my app, and used Chris Fletcher's blog here as a guide to setting up an Xcode project for multiple apps. I have everything working great except for the icon file.
Here is an overview of what I have:
2 info.plist files (One for each version of the application)
In my paid info.plist, I reference the icon "IconPaid" for the Icon entry. In my Xcode project, I have added IconPaid.png and IconPaid#2x.png.
In my lite info.pist, I reference the icon "IconFree" for the Icon entry. In my Xcode project, I have added IconFree.png and IconFree#2x.png.
When I go to build both apps, my lite app shows up with the paid icon. I took a look at the package contents of my lite app, and sure enough the IconPaid files were included but not the IconFree files. I took it a step further, and printed out the value for the CFBundleIconFile in my app, and it correctly shows up as "IconFree".
So my question - Where else is the icon file referenced in a Xcode project besides the plist file? I thought that was the only place...
It sounds like your free target is copying the paid version of the icon instead of the free version. Look under Targets/Project-Name/Copy Bundle Resources and check that the free version is copying the correct icon file.
I'm not sure why the IconPaid.png is showing in the free app (assuming your build settings of your free target are referencing the proper info.plist). You may want to clean all targets and delete your intermediate build files too, and delete the old version from your simulator or device.