I have a relatively big mobile ios app project and am building it on an M1 MacBook Pro. It's a mixed Swift and Obj-C prject.
When I am building it via Xcode for the "Intel Iphone Simulator" architecture - a clean build takes around 2.5 minutes. When I am building it for arm64 via Xcode - it takes around 15 minutes.
It seems to hang for a very long time on compiling a different seemingly random file each time. The swift-fronted process is still at 100% CPU use according to Activity Monitor.
The problem does not occur when I am building it directly via xcbuild or fastlane's gym.
I checked it on Xcode 13.2, 13.3 and 13.3.1.
I cannot find the reason for this, does anybody have a clue for why this is happening? Or maybe could point me in any direction?
I have an app working with my own framework. I made the framework build for i386 as well as arm and everything is fine. My app used to run on every simulators and is available on the store.
Now, for some reason, i can't run my app on some simulators.
The simulators that work :
iPhone 4s
iPhone 5
iPad 2
iPad Retina
The simulators that doesn't work :
iPhone 5S
iPhone 6
iPhone 6S
iPad Air
Resizable iPhone
Resizable iPad
The error is that a *.h file from my framework in not found.
I'd like to know what can prevent this file from being found, or rather what search path is not used with some simulators. There must be some project/target property that screws with those simulator types, except that i can't find any that would make a difference.
In my code i've searched for any kind of difference i would make, but they are just about iOS version regarding UI components. I also use TARGET_IPHONE_SIMULATOR but it should not make any difference between simulators.
FYI, my app version nows include Watch Kit. It's working on the Apple Watch as well as on the Apple Watch simulator attached to the iPhone 5 (external display). It may be related...
Any help much appreciated!
Edit: The full error description:
/Users/me/sources/myApp/iOS/trunk/include/someFile.h:18:10: 'dir/someOtherFile.h' file not found
Edit: Header files in all targets:
My framework and every files that include any .h of my framework are only part of the myApp, i took care not adding any reference in myApp.watchkit or myApp.watchkitextension
Edit: Solutions tried:
Xcode restart
Reboot
+Alt+Shift+K
Delete derived data
Edit: 64-bits:
I use some paths like that in the project file:
$(FRAMEWORK_SEARCH_PATHS)frameworkName_$(CURRENT_ARCH).framework/Versions/A/Headers
For example, it refers to '/searchPathFolder/frameworkName_i386.framework/...' when i build for simulators.
Solved. The issue came from my framework that for some reason wasn't build for 64 bits simulator versions.
For everything to work fine, the project needs 4 versions of the framework: x86 (32 bits simulator), x64 (64 bits simulator), armv7 (32 bits device) and arm64 (64 bits device).
Then with project properties, unnecessary frameworks are simply ignored at build time:
ignoring file myFramework_i386.framework/myFramework_i386, file was built for archive which is not the architecture being linked (arm64)
I have a third party library (ZBar) which complains about the armv7 arch when I build the project (in Terminal, using xcodebuild), and I have to set the valid architecture in the build settings to armv6 (only).
The question: Will an app set to armv6 even run on post iPhone 3GS devices?
Yes, ARMv6 code will run on an ARMv7 device, but not the other way around. You can test this by downloading an app that hasn't been updated in a long time onto a brand new iPhone 5, and it should run perfectly fine (while not being retina-optimized).
This is because the two instruction sets are backwards-compatible, but not forwards compatible. However, ARMv6 now is not that much of an issue, because of Xcode 4.5's limitation to be unable to compile ARMv6 code.
Note that the iPhone 3GS is actually the first of the iOS device list that uses ARMv7, which can be observed by the fact that it's the earliest device that can run iOS 6 (which requires ARMv7, the only exception being the first generation iPad), so as long as you are targeting iOS 4.3+, you don't need to support ARMv6 at all.
Seeing as the only 4 devices that are ARMv6 are the (iPhone 2G, iPhone 3G, iPod, iPod 2G). All of those devices should have been replaced by now, and it isn't our fault if they aren't.
The latest release notes indicates 4.2.1 and lower will not be supported, we now have to use 2 version of Xcode to develop when supporting older devices?? This is going to be difficult to support older devices if we want to develop iOS6 AND support 4.2 and lower.
I don't think Xcode 4.4 will support iOS6. So this is the issue. How would developers easily support these platform without so much hassle?
You can do this, but it requires some minor Xcode hacking, and some sacrifices. Depending on what you mean by "support iOS 6", this may or may not be sufficient for you. If you just want your app to run on iOS 6, then this should work. If you also need your app to incorporate new iOS 6 features, then it won't.
(Note for others who don't have a problem using multiple versions of Xcode: this similar question has answers that do allow you to also use new iOS 6 APIs and directly target armv7s)
See basic instructions on chpwn's blog here (but read the rest of this below, too!)
Basically, you can use Xcode 4.5 to build for iOS 4 and above, but then you can't take advantage of the new iOS 6 only features. So, you're really building for iOS 4 and 5, and assuming that the app will run fine on iOS 6 (which should be true, but you'll need to test this yourself).
You'll need to copy the iOS 5 SDK folder
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.*.sdk
from an old Xcode installation (which you'll need to keep around briefly, or reinstall to a non-standard location). You'll then set the Deploy Target in your Build Settings to iOS 4.0 (or whatever minimum OS you want). You may need to open the project.pbxproj file in a text editor to set this manually:
IPHONEOS_DEPLOYMENT_TARGET = 4.0;
You'll also need to set the Architectures to armv6 and armv7. You cannot directly also target armv7s. But, that doesn't mean your app won't run on iPhone 5. armv7 executables should run on iPhone 5, simply without any optimizations added in armv7s. It's just that compatibility doesn't work in the other direction (e.g. armv7 executables don't run on an armv6 iPhone 3G).
There's also a step that might be necessary, that's not mentioned in chpwn's blog. You may get these warnings (which really are errors, because Xcode won't generate your executable properly):
warning: no rule to process file '$(PROJECT_DIR)/main.m' of type sourcecode.c.objc for architecture armv6
In order to fix this, you'll need to setup a custom Build Rule for your target that tells Xcode to use LLVM GCC 4.2 to generate armv6 code. Define the rule for files matching the pattern *.[mc]:
This will be a different compiler than the Xcode default, and you may need to adjust some of the syntax in your Objective-C code. Even though many people wanting to do this probably wrote their apps before ARC, it is important to note that LLVM gcc 4.2 does not support ARC.
Finally, you probably will still see warnings from Xcode about iOS deploy targets less than 4.3, and armv6 not being supported. Those, I found, were not problems, and could be ignored:
Running lipo -info on my app executable after this shows the desired result:
lipo -info MyAppName
Architectures in the fat file: MyAppName are: armv6 armv7
Xcode 4.5 makes iOS 4.3 the earliest supported operating system, which effectively orphans the original iPhone and the 3G.
If you want to support iOS versions earlier than 4.3, you will need to keep around a 4.4 version of Xcode.
To be a bit clearer : you cannot easily (meaning Xcode does not out-of-the-box) support pre-4.3 devices and use iOS 6 features in the same app. That's because iOS 6 features require XCode 4.5 which also sets iOS 4.3 as the minimum supported OS.
So, you have 3 choices :
Continue using XCode 4.4. You'll be able to target pre-4.3 iOS. You won't be able to take advantage of iOS 6 features, but your app should run fine on it assuming you perform adequate testing on actual iOS 6 devices.
Migrate to XCode 4.5. You won't be able to target pre-4.3 iOS, but you'll be able to take advantage of iOS 6 features.
Make two versions your app. Build one version with XCode 4.4 (as in option 1), and the other with 4.5 (as in option 2). From the point of view of distribution, these will be 2 separate apps, they'll each have their own bundle ID, etc. You will have two entries in the app store.
If you are comfortable going beyond what is supported directly by Xcode, see Nate's answer.
The original iPhone and iPhone 3G are the only devices that don't support iOS 5. The iPhone 3G is now 4 years old. You may want to consider dropping support for iOS 4. If you don't want to do that, I think you'll have to develop in two different versions of Xcode.
I assume that the dropped support for iOS 4.2.1 is not the core problem. In fact, I tried to work around this and do the following:
Build the app with iOS 6 SDK, setting deployment target to iOS 4.2.1 (which works).
Pack the app for ad hoc installation and install the app on an iOS 4.2.1 device (iPod touch 2G).
Test the app.
However, installation fails. The reason here is - afaik - not the iOS version. The reason is the architecture. XCode 4.5 no longer allows you to build for armv6. It only builds for armv7. On the other hand: all device which have armv7 or better can run iOS 5. The only devices which do not support armv7 are iPhone, iPhone 3G, iPod touch 1G and iPod touch 2G.
So for me the question is: can you build for armv6 with XCode 4.5 and iOS 6 as base SDK?
Edit: Which you cannot do, because the iOS 6 base SDK is not available for armv6. Right?
Try to set the project settings manually using IPHONEOS_DEPLOYMENT_TARGET=4.0. However, I don't know if there is any side effect.
I think that targeting to 4.3 is the best choice, according to ios version statistics
I'm trying to run my application on my old 2nd generation iPod Touch running iOS 4.2.1 to test it on a non-retina device.
It seems that I have all the certificates and provisioning profiles setup properly, everything works with my iPod Touch 4th generation running iOS 5.0.
However, it neither shows my app on the iPod's screen nor the iPod's installed applications list in Xcode. Without any explicit warning from Xcode.
Could you tell me if I should downgrade to Xcode 3 in order to run and test my application on the old device, or am I doing something wrong? Where should I check?
Thanks!
#borrrden is correct that such a device is fine (just tested on one myself, in fact, using Xcode 4.3.x).
My first guess (though it seems odd you wouldn't get an error) is that you are only building for armv7, which at some point became the default in Xcode (don't recall whether this was in 4.2 or 4.3). You need to make sure that your "valid architectures" and related build settings include both armv6 and armv7 if you are targeting that range of hardware.