robiłem coś podobnego w chcąc zamienić moje ikony aplikacji z różnych katalogów aktywów w zależności od tego, czy zbudowałem debug, ad hoc, lub zwolnienie. Moim rozwiązaniem było nie umieszczanie katalogów debugowania i ad-hoc w żadnych celach, a następnie napisanie skryptu uruchamiania w Swift, aby skopiować te zasoby w czasie wykonywania. Oto skrypt:
import Foundation
struct CopyNonReleaseIcons: Script {
var usage: String {
return "When running a non-release (Debug or AdHoc) build, switches out the app icon to help" +
"differentiate between builds on the home screen.\n\n" +
"Usage: swift CopyNonReleaseIcons.swift <CONFIGURATION> <PRODUCT_NAME> <BUILD_PATH>"
}
var expectedNumberOfArguments = 3
func run(arguments arguments: [String]) {
let configuration = arguments[0]
let productName = arguments[1]
let buildPath = arguments[2]
if configuration == "Debug" || configuration == "AdHoc" {
copyIcons(buildName: configuration, productName: productName, buildPath: buildPath)
}
}
func copyIcons(buildName buildName: String, productName: String, buildPath: String) {
let sourcePath = "My App/Resources/Asset Catalogs/" + productName + "SpecificAssets-" + buildName + "Icons.xcassets/AppIcon.appiconset/"
var appName = "My App.app"
if (productName == "White Label") {
appName = "White Label.app"
}
shell(launchPath: "/bin/cp", arguments: ["-rf", sourcePath, buildPath + "/" + appName])
}
}
CopyNonReleaseIcons().run()
Tak Rozumiem, dlaczego mam ten błąd. Ale to naprawdę denerwujące, ponieważ xcasset powinien być lokalizowalny. Czy istnieje sposób na prawidłowe zlokalizowanie xcassets? –
Musisz utworzyć różne cele. Kiedy tworzysz plik xcasset, musisz połączyć ten plik z określonym celem. Sprawdź ten link: [link] (http://www.codeghost.co.uk/post/50912394435/multiple-ios-targets-from-a-single-xcode-project) – mrodriguez