Invalid deployment target of the framework - ios

I want to decrease the framework deployment target from iOS 10 to iOS 9. I did the fork of the library, changed deployment target of the framework TARGET (not whole project). When I build the dependency I can see in info.plist that deployment target is iOS 9 (screenshots attached) in the framework and iOS 8 in the framework's dependency. Anyway, my project where I attach those still outputs that iOS 10 is required for this framework (yes, i did clean, delete derived data, change simulator, reset xcode).
.../MyFile.swift:13:8: Module file's minimum deployment target is ios10.0 v10.0:
.../MapFramework.framework/Modules/MapFramework.swiftmodule/arm64.swiftmodule
(that's in Swift file in the line where I have import MapFramework)

The issue was happening, because by mistake, there were two copies of the same .framework in the file hierarchy. One was in Carthage folder, another one in root folder. Even though marking in Xcode -> Reveal in Finder on the framework it always shown framework in Carthage folder, somehow it was processing both of these. After removal of the framework located in root folder everything was working perfectly fine (I didn't have to change any paths or references in Xcode, what shows that Xcode all of the time was pointing to the correct version).
Seems like an Xcode bug.

Related

"No such module" error when archiving

My Swift 4 app rebuilds and runs successfully on all simulators except for Generic iOS Device. If I try to archive it or do a rebuild on Generic iOS Device, I get a No such module error relating to one of my pod frameworks.
I tried adding the framework to Linked Frameworks and Libraries, and that removed the error, but then it fails on the next pod framework, and so on. I have tried all sorts of paths in Framework Search Paths with no luck.
Currently, the value is set to:
I even tried deleting the workspace, the pod lock file, and the pods folder, and then I did a pod install to rebuild everything. Again, it rebuilds clean on any simulator except the generic one. On the generic one, I get No such module on all import statements for pod frameworks.
Any suggestions appreciated, as this problem has me completely stalled, since I can't get a release out.
For me what fixed it was removing one line from my Podfile and rerun pod install.
platform :ios, '11.0'
I think the version of the pods was not aligned with the version of my target, causing this issue.
I was able to fix the problem editing the ios version line in the Podfile to match the Project target version (10.0 in this case) in Info.
#Podfile
platform :ios, '10.0'
Finally I had to run
pod update
After that, I was able to Archive my project selecting Generic iOS Device
In my case I had selected a Device on Xcode when archiving, choosing Generic iOS Device solved my problem.
It's better to check the project settings by going to Build Settings, find Framework Search Paths and add $(SRCROOT) and be sure it's recursive.
I kept facing the issue "No such module" while archiving the app.
I tried this approved answer and it worked perfectly but, a new warning was appearing in my Podifle.
So I did the below and it worked without any warning.
Podfile :
XCode -> Targets -> My App -> General :
switched iOS from 10.0 to 11.0 and then everything worked perfectly.
Seems like by opening up the project by double clicking Runner.xcworkspace instead of Runner.xcodeproj, xcode can finally figure out where everything is. Even though you can still debug in an emulator and on a connected phone from the .xcodeproj file...
Seems strange that it would fix it. But I'm happy to have an Archived build now.
Check out this link for more info
There is another case similar to the same error. when you have an Embedded Framework project with min iOS 10 (Any iOS Device arm64, arm7) while I am archiving the build of the project with min deployment version iOS 11(Any iOS Device amr64) in Xcode 12.5.1.
I have to change the min deployment version of the Embedded Framework project to iOS 11(Any iOS Device amr64) to match with my project's deployment version.
first build your project command + b and see if the frameworks are in red when you look at then at the right sidebar, if they are, xcode did not find your files on the specified path, if not, building and then archiving should work
I was able to get it to archive by re-creating the project from scratch. I created a new project, used the same pod file to install the pod libraries, then copied everything over from the other project. I am now able to archive it and push it to the store. Must have been some corruption or a rogue setting.
In my case, the module which couldn't be found was a dynamic Obj-C framework with a minimum deployment target higher than my application project's minimum deployment target. Bumping my minimum version fixed it, but you could drop the version on the framework instead.

XCode creating half-sized static library

This issue is driving me nuts. I am asking it here before I announce it as a bug in XCode and try to use another version of XCode.
So, I am using XCode 8.3.2. I have a project that generates a static library. I am moving the .a file to another project and I use it (I know I can integrate the static library project in the second project but I don't want that here).
The file generated is 4.4MB. After copying the newly created .a and I copy it to the second project and test it, everything works fine. But when I come back to the library project and build it, the generated file is 2.3MB with missing symbols!!!
I cannot make it work unless I restart my MAC, or XCode somehow crashes.
What I have tried : Clean project, clean folder, delete Derived data, added -all_load -force_load -ObjC flags in my target linker flags.
If anyone has any idea about what is happening, please inform me.
Thanks!
It depends upon the target device you have selected during building your library. In Xcode, When you select any specific simulator or device, that time Xcode only creates single slice or thin product.
If you select Generic iOS device , means no device or simulator, that time Xcode create library having all the device slices and one folder having Simulator slice.
By using LIPO command you can put simulator and device slices together.
In your case, during first and second time, You are changing the device target from Generic iOS Device to specific device.

Xcode 6.1 static library .a for iOS not generated

I tried to make a static library for my iOS device using Xcode 6.1.
I choose on Xcode a new project with template Cocoa Touch Static Library and named it MyLib.
For MyLib target I choose iPhone 6 in the Simulator.
After the project was opened, I build MyLib with succeed.
But if I look to the Products folder, the libMyLib.a is red and nothing happens, if I want show it with finder.
In prior versions of Xcode it seems to work, how I find in some tutorials.
I found the solution: the library is created under
../Xcode/Products/Debug-iphonesimulator/libMyLib.a
If I switch the target to the my real iPhone 6 it works too and in the Products Folder the libMyLib would be black and the library is created under
../Xcode/Products/Debug-iphoneos/libMyLib.a
This happened to me as well. I believed the libMyLib.a was built successfully and sat under Debug-iphonesimulator folder but Xcode couldn't link to the correct path. Two way you can find it.
As OP suggested, build the library with iPhone 6. The target library should be in black and right click show in folder. The library folder for Debug-iphonesimulator is at the same level as Debug-iphoneos
Find your build target directory. Typically, it is under:
/Users/yourName/Library/Developer/Xcode/DerivedData/yourProjectName-wholebunchofalphebets/Build/Products

add xctest framework to an old project

how can I add xctest framework to an old project? When I try to add a new framework I couldn't find xctest in the available list in Link Binaries With Libraries.
I also tried edit->refractor->convertToXCTEst but select targets to use xctest: lists no targets
In Xcode 6.1.1, and also in Xcode 6.0.1, the XCTest.framework is not listed anymore as an available framework. In Xcode 5.1.1, however, the framework is listed.
So something appears to have changed between Xcode 5 and 6 when it comes to testing. For instance, when you create a new project in Xcode 6 you no longer need the XCTest framework. You can simply add a new test case, build and the test runs just fine. I have yet to figure out why this is the case, but for you this might be the first thing to try: Just code a test case and see whether things work.
If they don't, then you could try this ugly workaround: Open the project with an older version of Xcode, add the framework there, then go back to work in your new version of Xcode. This worked for me when I tried it with Xcode 5.1.1.
EDIT: The reason why XCTest.framework is no longer needed in projects created by Xcode 6 is because these projects have the build setting CLANG_ENABLE_MODULES set to YES. Xcode 6 exposes this in the UI under the name "Enable Modules (C and Objective-C)". With this setting enabled, any #import statements for system frameworks such as XCTest cause clang to automatically link against that framework. Details are available in the "Modules" section of the clang documentation. Once this build setting is enabled you can also remove any other system frameworks from the "Link Binary with Libraries" build phase of your targets.
And for completeness' sake: The reason why Xcode 6 no longer lists XCTest.framework as an available framework is because the framework's location inside the Xcode bundle has changed:
# Xcode 6
/Applications/Xcode-6.1.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest.framework
# Xcode 5
/Applications/Xcode-5.1.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk/Developer/Library/Frameworks/XCTest.framework
Apparently Apple now relies entirely on CLANG_ENABLE_MODULES to get test targets to link against XCTest.framework. If you want Xcode 6 to list XCTest.framework as an available framework, you can manually create a symbolic link inside the Xcode app bundle:
cd /Applications/Xcode-6.1.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks
sudo ln -s /Applications/Xcode-6.1.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest.framework .
You need to restart Xcode after creating the link.

iOS Development: problematic framework search path

I have an iOS app and I want to test it on simulator. When I run the project xcode complains that my framework file is "missing required architecture i386 in file".
I did a bit of search on line and it says that's because xcode used the framework files intended for actual device when building the project for simulator. Solution is to add the simulator framework folder under the framework search path in build settings.
Okay now the problem is, doing that solves the problem of building project on simulator, but later when I want to build the project on an actual device, xcode starts complaining again saying there are redefinitions of some of the openGL typedef in the framework. To fix this I have to remove the search path item that I added.
So is there an easy way to avoid having this kind of problem? I don't want to switch the search path over and over again when I want to build the project on different platform.
If you upgrade a project from 4.2 to 4.3.2 style it often loses the architectures required for the target you are building for. Usually you just have to add them back or change the target SDK.

Resources