Using Multi-Platform Projects in CocoaPods target framework - cocoapods

I am working on a project with multiple platforms (iOS, tvOS). This project has a target, with Allow Multi-Platform Builds enabled.
target 'TestTarget' do
project 'TestTarget/TestTarget'
pod 'SomePod' => '~> 9.2.1'
platform :ios, '12.3'
end
This works for iOS now, but tvOS won't compile anymore, because it doesn't link the framework properly. I can only set one platform in the Podfile for that target, but need to set tvOS as well.

Related

iOS-only SPM targets built against watchOS

Our project uses several 3rd party packages using Swift Package Manager. Some of them are shared among the iOS and watchOS project, but several packages depend on UIKit, so they are not included in the "Frameworks, Libraries, and Embedded Content" part of the WatchKit Extension target in Xcode project settings.
I can build the iOS or the watchOS app and run in Simulator or on a device, but when I want to preview SwiftUI files included in the watchOS application, building fails.
What I read from the build log is that Xcode wants to build all of the packages added to the iOS project against watchOS too, which will fail obviously.
Is some of my project settings bad or is this a bug?
It seems to be an unresolved bug on Xcode 14.
There is an opened discussion on Apple Developer forums

how to develop tvOS app using nativescript

I'm trying to build a tvOS and roku app with nativescript.
I was about to start working on the tvOS app after I read this article https://www.nativescript.org/blog/running-the-nativescript-runtime-for-ios-on-apple-tv but I'm not sure where the nativescript ios runtime or the metadata generator are in my project. Also, would this mean that my provisioning file and certificates should be for an appletv app instead of ios?
The iOS runtime is generally downloaded from NPM for your project. But it includes support for only iOS. For tvOS, you will have to checkout the open source iOS runtime project from Github and update the config scripts as described in the blog post,
set(CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos;-iphonesimulator;-appletvos;-appletvsimulator")
set(CMAKE_XCODE_ATTRIBUTE_SUPPORTED_PLATFORMS "iphoneos iphonesimulator appletvos appletvsimulator")
and build your custom version of iOS runtime with CMake.

How do I delete extraneous deployment target settings from a build target

I have multiple build targets in my project. Some have tvOS set as the Base SDK whereas others have iOS set for this build setting. For some reason, despite only having one Base SDK set per build target, there are some that have multiple of the 'OS X Deployment Target' properties set.
Deployment targets shown in Xcode:
iOS Deployment Target iOS 8.0
macOS Deployment Target
tvOS Deployment Target tvOS 9.2
watchOS Deployment Target
There is no blank option when I click on the dropdowns of versions next to the deployment target settings. Is there any way to remove one of these?

Swift universal iOS framework with CocoaPods dependencies

I've been trying to build an iOS universal framework that includes a CocoaPod dependency, namely SQLite. However, the problem that I keep getting is that I cannot use the framework as such either when building the app within the simulator, or physical device. This greatly depends on the type of device I've chosen when building the framework.
To solve this issue, I've followed these script: iOS universal framework script
Any piece of advice onto what is the best common practice for building an universal iOS framework that includes a CocoaPod dependency?

Why isn't Xcode building the second target of my project?

I've downloaded an Xcode project (a QR code encoder) that has two products:
a library
a demo which uses the library
When I do a build or a run, it just builds the library.
How do I configure Xcode to build both targets, and load the demo app when I do "run"?
I'm using Xcode 4.6.2.
I left my answer in the comments section.
The build scheme had the lib and target in a drop-down with the lib selected.
When I changed that selection from lib to demo and rebuilt it build both targets and downloaded the demo app to my phone.

Resources