How to not automatically embed Swift dynamic libraries in Xcode 8?
I've tried setting ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES to "No" (defaults to "No" anyway) yet it still copies Swift dynamic libraries into the app bundle.
I'm creating a helper application to be embedded in the main application and the latter already has Swift libraries which the former can link to.
Swift may still be copied even for ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES set to NO. You can check if there is some Swift file in your project or any of your dependencies and remove those.
Related
In Xcode 10, the "Copy Swift standard libraries" script is done last — after any custom build phases that may be added to the target. Hence it is not possible to create a custom build script to specifically remove Swift standard dylib files added by Xcode.
The question is, how to remove some of these standard libraries that are erroneously added by Xcode?
The reason behind it is that when Xcode 10 builds a Swift 4.2 macOS app that has a Photo Editing extension, it adds libswiftMapKit.dylib into the application bundle — even when the application does not have Maps functionality or import MapKit. This caused an App Review rejection.
To remove a Swift Standard Library, add a Post-Actions in the scheme. Most likely this would be an Archive post-action since archiving is typical prior to a release (upload to App Store or to re-sign using a Developer ID credential).
In Xcode 10 Click Edit Scheme.
In the scheme editing, expand the Archive section.
Click on Post-Actions
Enter the following bash script fragment (along with any other post-actions that you may already have)
# This variable points to the `Frameworks` folder of the final application.
full_frameworks_path="${ARCHIVE_PRODUCTS_PATH}/Applications/${FRAMEWORKS_FOLDER_PATH}"
# Specify the libraries to remove, the example below removes Swift's MapKit wrapper.
rm -f "${full_frameworks_path}/libswiftMapKit.dylib
However note that this does not solve the underlying problem of the Photos App Extension actually links to libswiftMapKit.dylib — a dependency added by Xcode 10.0 regardless whether it really uses MapKit or not.
I am using Xcode 4.2 build 4C199(for MAC OSX 10.6.8). I create a new project and select the AppDelegate.h .m file and close the file. When I reopen the file I see a set of objects in the Objects Library in the Utilities panel that are either new or different. There are many more objects than usual. I'd like to use them, but when I click on either a .xib file or a storyboard file the new objects are replace by the normal old objects .Is there a way to access these new objects? Please refer my screenshots below.
These are objects, that are only available on the Mac platform. Please make sure you really created a project targeting the iOS platform. Have a look at the base SDK. It should specify an iOS SDK.
If something went wrong there just create a new project using the right template.
My project is iOS. I upgraded Xcode 4.3 to 4.3.3 last night and had the same problem on my first launch of Xcode after the upgrade: the object library contained only OSX objects.
It certainly looks like an Xcode bug. My workaround: in the Build Settings, I changed the "iOS Deployment Target" pulldown to a different SDK, then changed it back. After that, I got the iOS objects back.
See also here.
I'm getting all kinds of build errors with Facebook's SDK because my app uses ARC. I try to remove the Facebook files from the compiler to avoid this, but I get an Apple Mach-O error when I remove the Facebook.m file. If I put that back in the compile sources, I get the ARC errors.
Anyone run into this?
Do you exclude them from arc with Compiler flag
-fno-objc-arc
?
You can see a Answer here
And this is why distributing a shared library by copy and pasting files is bad. A library should be distributed as it's own Xcode projects with a static library target, so that the build setting requirements of your projects and the libraries you use can not screw up one or the other.
File a bug for the Facebook SDK here: https://github.com/facebook/facebook-ios-sdk/issues
And in the mean time add the -fno-objc-arc flag to the implementation files in the Facebook SDK. You can do this by;
Select your application target
Go to the Build Phases tab
Add for each file under the Compile Sources section.
The new SDK does not explicitly support ARC out of the box, but there is a shell scrip to build a static library that can be used within your ARC project. Just navigate to your local git repo and run
% ~/facebook-ios-sdk/scripts/build_facebook_ios_sdk_static_lib.sh
This will create the static library under the /lib/facebook-ios-sdk folder (e.g. ~/facebook-ios-sdk/lib/facebook-ios-sdk). You may then drag the facebook-ios-sdk folder into the app Xcode project to include the iOS Facebook SDK static library.
there are actually very few changes needed to make the Facebook iOS sdk compatible with ARC. I have made the changes in my code , but , I do not know who to send it back to the community, any pointers ?
here is a post I made to explain how to use it with ARC the simple way on Xcode 4.2:
http://nabtech.wordpress.com/2012/02/02/facebook-ios-sdk-and-arc/
I'm fairly new to the iOS SDK and Xcode and I stumbled across this XML-RPC framework https://github.com/eczarny/xmlrpc that I'd really like to use in one of my projects. I downloaded the sources, the initial target was set to Mac OS, so I changed that to iOS 4.3 but got the following dependency error:
target specifies product type 'com.apple.product-type.framework', but there's no such product type for the 'iphoneos' platform
So I removed all the targets and added a new one from scratch using the Cocoa Touch Static Library, and it seems like it's been built just fine. Now my question is whether this is the correct way to build that library for iOS development, and where do I take it from here? I can't find the .framework directory anywhere (the install dir was set to "#executable_path/../Frameworks") so I can't embed it in my iOS project. How exactly does this go? Thanks!
Thanks for your help and sorry if this is too "newbish". Cheers!
If you're using Xcode 4.x open the Organizer, select the Projects tab and then down the left hand side you should see an entry relating to the XML-RPC project. Select that and under the Derived Data heading you'll see a path which if you follow using finder should lead you to the folder containing the static library you've built.
So I am working on an app that was compiled on sdk 3.2 and 2.2.1, but I have sdk 4.0. When I compile it, I get many build errors "Pattern colors not supported by the iphone SDK for iphone OS versions prior to 3.0" and "setText is deprecated."
Furthermore, when I open a nib file and try to change the colors, add in an item from the library, or mess around with it my changes and additions don't show up during runtime. I am thinking this is an issue with the interface builder, particularly the different SDK versions.
Is this the case? I am programming for the ipad, so I need at least 3.2?
Open the .xib file in Interface Builder, then select Window > Document Info, select a later version of Deployment Target OS version.
Your errors of "setText is deprecated" is an error in your code because apple updated their framework. The easiest to fix that would be to check the framework for a comment that says what to use.
When you make a change to a nib file, interface builder and Xcode require that you save before building the project.
The iPad is only 3.2, so yes you will need to build it for iOS 3.2.
Sorry I am OP, had to create an account since I was using a temp one.
Thanks for the answer, however, I'm not too worried about setText is deprecated because it builds successfully.
Regarding the nib file, I did save, clean and rebuild the project. I'm working on someone else's code done in earilier sdk's, and when I delete their objects in IB the app will still run fine, as though the interface builder is not responding. I add objects in the nib and they won't show up. If I do this is projects I create, it goes through finely. My guess is it's the different sdks?