What are the effects of disabling BitCode in Xcode project settings? - xcode

Bid code is by default enabled on XCode project settings.
I am dependent on few third party libraries where I get compilation error as the SDK is does not support BitCode?
If I disable the error is gone. But I do not know the after effects of this change?

Turning it off simply means that your app will live on the app store the same way it did before Xcode 7 & Bitcode. When it's downloaded, binary code for all supported architectures get downloaded from the App Store.
If you turn BitCode on, then the intermediate representation of the compiled program gets uploaded and Apple will able to recompile and/or optimize your apps for future architectures (as described here).
Turning it off is very safe for the time being.
More information can be found in this related question.
And like you, I'm waiting for certain third party libraries to be updated for BitCode support (in my case, it's the Google Analytics library).

Related

Xamarin iOS App Size 60% Increase Since Last Build With Same Code

I have a Xamarin Forms app that is currently on the App Store that I built and submitted in October 2016 (with what I assume was the latest versions of Xamarin Studio and Xamarin.iOS back then). The app has a size of 50 mb on the App Store.
After doing a few updates to the app, I build it now (AppStore config, then Archive) and the size is 82 mb. Confused by this balloon in size, I switched back to the git tag of the version that is currently in the App Store. I can build the same exact tag/version/code for that October 2016 release and it's App Store size is now 80 mb.
I am using the latest Xamarin Studio (6.3 build 863), Xamarin.iOS (10.8.0.175), etc.
Why has the size grown by 60%? No application code or libraries have changed, only newer versions of Xamarin Studio and Xamarin.iOS. How do I figure out what is going on here? I can do an Add-Hoc build on my device and see that is only taking up ~55 mb, very close to what I see from the App Store.
Also, note that I am not comparing the .ipa size. I am comparing the "Estimated App Store Size" shown from the archive screen in Xamarin Studio after archiving a build. The same size difference is reflected after submitting the signed build via application loader to iTunes Connect and verifying from iTunes Connect > Activity > All Builds > App Store File Sizes.
Update Sept 5th 2017
Not sure what changed but now with the latest version of Xamarin iOS, Version: 10.12.0.20 (just updated), my app size is now back down in the 60mb range... Didn't change anything else.
I can do an Add-Hoc build on my device and see that is only taking up ~55 mb,
You likely have some different options between your configuration, e.g.
managed linker settings, e.g. Don't link versus Link SDK;
targeted architectures, e.g. armv7+arm64 versus armv7+armv7s+arm64;
How do I figure out what is going on here?
Compare your build logs, in particular the options given to the mtouch tool. That will generally pinpoint the difference quickly.
I am comparing the "Estimated App Store Size"
Always compare the IPA (file) size. The algorithm to guess the final size is known to be often (very) wrong. The estimation also comes from Apple's tools so they will vary with the version of Xcode you're using (which is unlikely to be identical to the one you used last fall).
Side note: the final size is even trickier to guess when bitcode is enabled (which is only for tvOS and watchOS builds right now).
My guess is that xamarin is packing a lot of unneeded stuff, maybe old images or similar that you are no longer using. I have experienced that myself.
Go to you project folder and delete everything in the obj folder
<myproject>/iOS/obj/
Usually you will see two folders in there: iPhone and iPhoneSimulator.
Delete those and build everything again, there's a good chance that will solve it
Are you using the same version of Xamarin to build your code. I am willing to bet that is the issue. Something changed in how Xamarin builds apps since the last time you released it and is blowing up your app build size.
If you actually have the same code you released back then do you know what version of Xamarin you used back then? Honestly since the only thing that's changed is the Xamarin compiler it is most definitely the issue.
There are four things to do:
DELETE bin and obj folder from client project
CHANGE architecture to only support 64
CONFIGURE the linker.
Best is to try and build your app with linker active, but the more nuget packages you use, the less likely this is
and most importantly:
Set your build config to RELEASE and not DEBUG
(if you forget that, stores will accept your app but size can easily be doubled or even trippled)
This is how the minimal setup should look like:
Then dont forget that XAMARIN adds libraries like crazy to your app. I once read that the smallest app with NO content at all is at least 7 MB. This only gets larger with each package and each new dependency.

Why do Swift standard libraries need to be copied and embedded in every Swift app? [duplicate]

I have just create a simple project using swift language, then i compile and archive it to generate .ipa file. IPA file is so big, it is about 5 MB.
is it right(no problem) at there? when i create it in Objective-C, it is only about 500kb.
Yes, that's about right. The libraries containing the entire Swift language have to be embedded in the IPA. Those libraries are part of the app, not part of the system - because Swift has to work even with backwards compatibility, in part because it is constantly changing (independently of system updates), and in part in order to work on iOS 7 (where the system has never heard of Swift). And they are about 5MB in size.
To expand on matt's answer, here's a quote from the Swift blog on compatibility:
You can trust that your app will work well into the future. […] This is possible because Xcode embeds a small Swift runtime library within your app’s bundle. Because the library is embedded, your app uses a consistent version of Swift that runs on past, present, and future OS releases.
So if your newest app version was built with Xcode 6.0, and a user of your app is running iOS 8.1, and breaking changes to Swift were introduced to your app in between, your app won't break due to the iOS update. If your app just used system libraries, it could.
This allows the developers of Swift to iterate more quickly without needing to build backwards compatibility between every version.
An additional warning:
While your app’s runtime compatibility is ensured, the Swift language itself will continue to evolve, and the binary interface will also change. To be safe, all components of your app should be built with the same version of Xcode and the Swift compiler to ensure that they work together.

Mac App Store Bundle Downloads

After reading through the extensive App Store guidelines (mac app store specifically), I've noticed a contradiction....
On one hand, under functionality, it clearly states:
2.7 Apps that download code in any way or form will be rejected
2.8 Apps that install or launch other executable code will be rejected
Yet when you read up further about purchase types, it often refers to in App Purchase 'downloads' and I'm pretty sure I remember reading in the bundle development guide (specifically plugin development) that these could be considered as in app purchases?
in 2.7 and 2.8 above, do they refer to code that they haven't checked i.e myAppPurchase.bundle which wasn't submitted at the app submission time, or is this concrete that absolutely NO bundles checked or unchecked by apple can be downloaded at all?
So in short, should an app be created in it's entirety i.e. with all the 'in app purchase extras' or can it be done modular i.e. an in app purchase downloads an approved bundle from the app store?
Cheers,
A
Although you can download content for in-app purchase, you aren't allowed to download code for later incorporation into the application. There are some theoretical edge cases, as you might have your own interpreter and might be able to download some amount of interpretable code in that case, you cannot download native code which will be executed either as part of the application (plugin) or an externally launched application.
As for the question of why Apple would cover this in the docs, it's likely because its the way that OS X and iOS apps are stored in the file system. Until Apple decides to allow downloadable binary executables, we're stuck using Plugin bundles in OS X only, ditto for non-OS framework bundles, which would arguably be even more useful. In particular, we have some bundles that are iOS/OSX cross-platform that we have to statically link under iOS, which is a shame.
Apple's apparent take is that if we can load code dynamically, then it is an opportunity to circumvent their review process by downloading an offending code module after the initial (or subsequent) program load. Imagine, for example, an application that talks to a server to download code which violates one of Apple's guidelines. If the version that is making the request has not yet been "released" by the malicious developer, no code is returned, and it just looks like it's checking in for an informative message of some kind. However, once Apple approves the App, the developer tells the server to start sending back a dynamic library, framework, or plugin which is then executed at the appropriate time by the now-malicious code.
The difficulty is that to prevent this from happening (through dyld or similar), you need to either whitelist everything that can be loaded, or you need to just prevent its use by application code altogether.
There's certainly the possibility that some kind of approved code whitelist could be used in the future, but until then, Apple has apparently chosen the route of just preventing the use of dynamic linking of non-system frameworks.

MonoTouch to XCode Export

I am bidding on a project where the client wants the mobile app delivered in an XCode project as that they can sign it.
Can I build in MonoTouch, then "Export" to Xcode so that I can deliver that to the client?
My experience is that I can build in MonoTouch in roughly 1/2 the time as I can in Xcode. Mostly due to MonoTouch.Dialog and C#'s framework sugar.
I am using MonoTouch Enterprise 5 and MonoDevelop 2.8
I think a lot depend on the definition of "export to Xcode" and I encourage you to clarify this with your client.
If the technical requirement is simply to sign the application the know that the code signing step, done with MonoDevelop (or with the mtouch command-line tool), is simply calling the codesign tool which is provided by Apple. That step is applied on a fully built .app (directory) so anyone should be able (with the right certificates/keys) to sign it (as long as the .plist data match).
There is also some support to (in mtouch) to build an Xcode project (see --xcode option) that could prove useful. This is something you can (and should) try to ensure it can as is match your (client) requirements.
Finally there could be ways to create a dumb Xcode projects that could be used only to copy and sign files. I'm pretty sure that would be possible with VS.NET/msbuild and MonoDevelop/makefiles - but I don't know Xcode well enough to say if that's a possibility.
Conclusion: the only thing I really don't doubt is that you can make this with MonoTouch[.Dialog]/C# in half the time than other solutions ;-)

iOS: 4.2 or lower must include ARM6 object code? [duplicate]

In iOS5 Apple drops the armv6 architecture from the ARCHS_STANDARD_32_BIT.
In order to keep the support for iPhone3G I still want to compile in armv6 even in iOS5.
Did anyone find a solution for this?
I just built something today specifying a deployment target of iOS 4.0. With only armv7 specified in Architectures, Xcode warned me that to support anything below iOS4.2 I had to include armv6 in Architectures. Just edit that field, click the "+" button when the dialog pops up and enter the literal "armv6".
In my case, we want our app to work under iOS4 and iOS5. We had to make some modifications so it would work correctly under iOS5, but all those changes were done with iOS4-friendly code changes.
We also added some iOS5-specific capabilities in a manner that allows the app to run without crashing under iOS4. Specifically, we tested for iOS5 capabilities before trying to use them, and linked iOS5-only libraries as Optional.
So, supporting iPhone3G in an iOS5 world could just as easily mean "we want our app to run on iOS4 and above (regardless of any iOS5 feature use)" rather than "we want to make sure our app runs on an older device running iOS5". There's a difference here; think about it. :-)
Anyway, adding armv6 support back in is very easy. And I guess the point is this: At some point, when there are no more armv6 devices out there to worry about (for whatever reason) you won't have to build for it. Apple's view is everyone should upgrade to the latest hardware as soon as possible. So in that world, there is no need for the tools to default to anything but the latest and greatest too. :-) Fortunately (or not), we developers live in the real world and recognize that you have to support older stuff for a while. And I guess the Xcode dev team knows this too, which is why you can add armv6 support back in quite simply.
The simple answer is that you have to change the current settings from "Standard (armv7) - $(ARCHS_STANDARD_32_BIT)" to just be "armv6" and "armv7". See the image below. You have to delete the line with the previous settings for it to work.
also make sure you set this in Project AND Targets ... cost me an hour to figure that out. had set it for one but not the other. hope this helps. GLTA
I think there's a reason why Apple dropped armv6 from the standard setting.
I have compiled armv7/armv6 with iOS5 SDK, however, the armv6 compiler produced wrong code in release mode. After hours of finding a workaround (trying llvm or gcc with different optimization levels) I give up.
So, I am going back to iOS SDK 4.x as long as I support older armv6 devices.
Example of code:
// myView center=(160, 100)
CGPoint p=myView.center;
// now p=(100,100) (what the heck?)
p.x=myView.center.x;
p.y=myView.center.y;
// now p=(160,100)
p.y+=100;
// now p =(200,200) (what the heck?)
Maybe I'm have some memory corruption, however, on the armv7 compiler and on iOSSDK < 5.0 it behaves as expected.
Best regards
Not sure if this is actually a solution yet, but I have discovered that replacing the defined string in "architectures", which was $(ARCHS_STANDARD_32_BIT), with "armv6 armv7" allowed me to compile with iOS5 as a base and iOS4 as a deployment target, and pass validation .
I am not using any IOS5-exclusive libraries or calls, but intend to in my next release.
I did not need to replace $(ARCHS_STANDARD_32_BIT) with just armv7 for the app to compile and be uploaded to the App Store.
As suggested by MarkGranoff, I simply added armv6 as plain text, by hitting plus and just typing it in on line two.

Resources