In a Mixed 3.2.5 iOS/MacOS project, there is an existing iOS static library target, and I'm adding a MacOS static library. In the target build settings(all configurations) I
set the Base SDK to "Latest Mac OS X"
set Architectures to $(NATIVE_ARCH)
set Valid Architectures to i386 only
use my own PCH file
drag headers into Copy Headers, Mac target
drag source into Compile Sources, Mac target
add the Foundation.framework found at /System/Library/Frameworks/Foundation.framework, set it to the new Mac target
(/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk/System/Library/Frameworks/Foundation.framework is also present, but set to the iOS target static lib)
the target compiles but the product appears NOT in "Debug" but in "Debug-iphonesimulator" instead. I'm assuming this is linking to the iOS Foundation? Whatever it's doing I can't assume that's safe.
changing the order of how I add things seems to have no effect.
any suggestions?
I suggest upgrading to Xcode 4. I have projects that build Mac and iOS libraries and both work as expected.
Related
I am trying to build my iOS/iPadOS project on my mac using the new Mac Catalyst. When I build it on the simulator for iPhone everything is fine but when I build it on my Mac, I get this error.
in /Users/nevin/Documents/[projectName]/Pods/Crashlytics/iOS/Crashlytics.framework/Crashlytics(CLSInternalReport.o), building for Mac Catalyst, but linking in object file built for iOS Simulator, file '/Users/nevin/Documents/[projectName]/Pods/Crashlytics/iOS/Crashlytics.framework/Crashlytics' for architecture x86_64
This happens for multiple pods so if I remove Crashlytics for example, I get a similar error for another pod. Does anybody know if this is something that Crashlytics needs to fix or is it something that I can fix within my project?
Mac Catalyst uses x86_64 but compiled with a target for Mac Catalyst.
I have a project that compiles for Mac Catalyst, you need to add these flags:
https://github.com/ezored/conan-darwin-toolchain/blob/stable/1.1.0/conanfile.py#L183-L188
If your frameworks are not compatible, don't link it in "General > Frameworks", but select "iOS" instead of "macOS + iOS". Example:
And in your swift code add IF code to check if your framework can be imported and used with this:
#if targetEnvironment(macCatalyst)
print("UIKit running on macOS")
#else
print("Your regular code")
#endif
With this, you can make apps compatible with Mac Catalyst. And when your frameworks (like Crashlytics) be compatible check "macOS + iOS" again and remove check on code.
Another option is to make another target for Mac Catalyst and put only things for Mac Catalyst, but with my first option, you can build without problems.
And if you want to make frameworks with Mac Catalyst support with C++ code you can check my framework (https://github.com/ezored/ezored).
I am directly linking PLCrashReporter in my iOS app without using any external tool and now when I try to compile it on Xcode 7 I get link error:
ld:
'.../CrashReporter.framework/CrashReporter(libCrashReporter-iphoneos.a-armv7-master.o)'
does not contain bitcode. You must rebuild it with bitcode enabled
(Xcode setting ENABLE_BITCODE), obtain an updated library from the
vendor, or disable bitcode for this target. for architecture armv7
Where do I get the updated framework or the sources to compile them with bitcode enabled and get rid of the error without disabling bitcode for the full project?
I ended up addressing this by building PLCrashReporter 1.2.1 from source. This version is the minimum that has had Xcode 7 and iOS9 fixes merged.
The source is obtained from here: PLCrashReporter 1.2.1
Unzip the downloaded 1.2.1 source into a folder.
Pull the Xcode project inside that folder up within Xcode and add the following to the Custom Compiler Settings "Other C Flags" section of the project build settings: -fembed-bitcode
Next add the following to the Custom Compiler Settings "Other Warning Flags" section of the project build settings: -Wno-error=unused-command-line-argument
Then close the project from the Xcode GUI. The custom settings are necessary because we are going to build from the command line using xcodebuild to avoid the PLCR deprecation errors, and when doing so the default is only -fembed-bitcode-marker when building a framework this way. We are overriding the default behavior, and need to suppress the hard stop warning this causes.
Lastly, from a terminal window prompt within the folder where the zip file of the source including the xcode project file is located run the following:
xcodebuild -configuration Release -target 'Disk Image'
This will run the build and leave the framework in ./build/Release/PLCrashReporter-1.2.1/iOS Framework
Now, these steps will produce a bitcode enabled framework, but third party crash reporting is incompatible with bitcode (when the App Store recompiles you have no way to get the symbol file from that on the fly build).
There is 2 options.
1. Download PLCrashReporter sources and compile it whit bitcode enabled, and use that in your project.
2. Disable bitcode for your target
Go to your target's Build Settings tab, search for Enable Bitcode set value to NO.
This worked for me, in order to include Rollbar framework in my project:
Within my workspace, I first select my project from the Project Navigator -> my project's target -> Build Settings -> Enable Bitcode = NO
Then I select the PODS from the Project Navigator -> Rollbar Target -> Enable Bitcode = NO
Experienced same issue. I built the crash reporter framework from source using
https://www.plcrashreporter.org/code
Open it in Xcode
Select the 'CrashReporter' target with the red bullseye.
Build it
Then search in ~/Library/Developer/Xcode/DerivedData/CrashReporter-xxxxxxx to get the .framework bundle
Unfortunately the issue presented itself again. Also when I try to compile again I get:
ld: warning: object file
(/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_macosx.a(cf.o))
was built for newer OSX version (10.6) than being linked (10.5) ld:
warning: object file
(/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_macosx.a(arclite.o))
was built for newer OSX version (10.6) than being linked (10.5)
Moreover if I set enable bit code at the project level I get an immediate error:
target 'CrashReporter-MacOSX-Static' has bitcode enabled (ENABLE_BITCODE = YES), but it is not supported for the 'macosx' platform
What should I do to produce the framework with bitcode enabled?
I have a number of iOS Xcode projects that all use the same subproject. This subproject builds a static library, that's then linked to the master project. Up until now this subproject and all master projects have been 32-bit.
I want to build a new project with 64-bit support, so have set the architecture to "armv7, armv7s, arm64".
Of course, I had to update the shared subproject to "armv7, armv7s, arm64" as well.
Everything builds fine.
However, now when I build old 32-bit-only projects to run on 64-bit devices it fails, because Xcode builds a 64-bit non-fat version of the static library from the subproject, which it can't link to.
Is there a way to tell Xcode (linker flag?) to build and link to the 32-bit version of the subproject, because the master project is 32-bit?
Thanks,
Russell.
Answer was that I had "Build Active Architecture Only" set to Yes in the subproject by mistake, causing it to always build a thin library. Setting to no, builds a thick lib with all supported architectures, meaning it'll work with a parent 32-bit project!
I'm using zipArchive library in Xcode to integrate into my project to do unzip operation. And I got following compile error message. my question is how can i resolve this compile issue?
What steps will reproduce the problem?
download ziparchive from http://code.google.com/p/ziparchive/:
create a new xcode project (just use single view template), select ios4.3 simulator
drag the download unzipped folder to project, and select "copy item..." ,"create group", and check the "add to targets"
What is the expected output? What do you see instead?
Compiled error with error message : invalid deployment target for -stdlib=libc++ (requires iOS 5.0 or later)
What version of the product are you using? On what operating system?
mac, xcode4.5.1, iphone4.3 simulator (it's OK in iOS6)
The file ZipArchive.mm from the ziparchive project has the suffix .mm for Objective-C++ files. However, the file does not seem to contain any C++ code. After renaming it to ZipArchive.m I could compile it even for iOS 4.3 deployment target.
A different solution of the problem can be found in the Xcode 4.5 Release Notes:
Projects created using this Xcode release use the new libc++
implementation of the standard C++ library. The libc++ library is
available only on iOS 5.0 and later and OS X 10.7 and later.
To enable deployment on earlier releases of iOS and OS X in your
project, set the C++ Standard Library build setting to libstdc++ (Gnu
C++ standard library).
I'm using Xcode 4.4.1. I'm getting this warning:
Missing SDK in target MyApp iphoneos5.0
I want to target iOS 5.0 and up. Where should I look to fix this?
In Target, Build Settings, Base SDK is set to iphoneos5.0.
EDIT: Furthermore, if I set the base SDK to latest iOS (5.1), does that mean that users running 5.0 will not be able to install the app?
It means your build settings are incorrect. You set the string to "iphoneos5.0" which doesn't exist anymore. You will now be compiling against "iphoneos5.1". Instead you should simply choose "Latest iOS" (= "iphoneos") To have the compiler select automatically.
Users will still be able to run your app on any version above your app's target version (assuming you didn't use any libraries that don't run on those lower versions).