If you add a (SiriKit / Widget) intent definition file to an Xcode project and then translate it into another language, the build of the iOS app only works until you close the project. As soon as you open the project again, you get the error message with the next build:
Unexpected duplicate tasks
A workaround for this bug is, that you convert the folder (where the intent file is located) in Xcode to a group. After that every thing works without problems.
Steps to reproduce:
Create a new iOS project
Add a localization to the project (German for example)
Add a SiriKit Intent Definition File
Localize the SiriKit Intent Definition File
Build the project (should work without errors)
Close the project
Open the project again
Build the project again
Expected result:
The project builds without problems
Current result:
The project doesn’t build and returns the error: Unexpected duplicate tasks
Is this a known problem? Is there a way to solve this without switching to Xcode groups (instead of folders)
Post
Replies
Boosts
Views
Activity
I have enabled an App Group in my App and the Widget Extension. I use it to share my UserDefaults. Every time the app starts I now get the following error message in the Xcode console:
Couldn't read values in CFPrefsPlistSource<0x303034510> (Domain: group.XX.XXXX.XXXX, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null), Contents Need Refresh: Yes): Using kCFPreferencesAnyUser with a container is only allowed for System Containers, detaching from cfprefsd
The shared UserDefaults itself works without problems.
Any ideas how I could get rid of this warning?
I have created a tip with a parameter (Bool) I have tried to set it to true in a sheet which is presented modally over the view which should present the popover tip. After the sheet gets dismissed the popover tip is never presented. If I restart the app, the popover tip appears. Is there any way to trigger the presentation of a popover tip manually?
I have created a little demo app to demonstrate my problem:
Setup TipKit on app start:
import SwiftUI
import TipKit
@main
struct TipKitDemoApp: App {
var body: some Scene {
WindowGroup {
ContentView()
.task {
try? Tips.configure()
}
}
}
}
Simple tip:
import Foundation
import TipKit
struct DemoTip: Tip {
@Parameter
static var enabled: Bool = false
var title: Text {
Text("Demo Tip")
}
var rules: [Rule] {
[
#Rule(Self.$enabled) { $0 == true }
]
}
}
Content view which includes the popover tip and displays the sheet where the tip can be enabled:
import SwiftUI
struct ContentView: View {
@State private var presentDetail = false
let demoTip = DemoTip()
var body: some View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text("Hello, world!")
.popoverTip(demoTip)
Button("Present Details") {
presentDetail.toggle()
}
}
.padding()
.sheet(isPresented: $presentDetail) {
DetailView()
}
}
}
In the detail view the tip gets enabled, but if I dismiss this view, the tip only appears after I restart the app:
import SwiftUI
struct DetailView: View {
@Environment(\.dismiss) private var dismiss
var body: some View {
Button("Enable demo tip") {
DemoTip.enabled = true
}
Button("Dismiss") {
dismiss()
}
}
}
With Xcode 15.0 Beta 5 (swift-driver version: 1.87 Apple Swift version 5.9 (swiftlang-5.9.0.124.4 clang-1500.0.38.1)) I can't create a valid URL with the following String:
URL(string: "127.0.0.1:8000/test")
With Xcode 14.3.1 (Apple Swift version 5.8.1 (swiftlang-5.8.0.124.5 clang-1403.0.22.11.100)) this worked without any problems.
Does anyone know if this is a bug or intentional?
Hello,
is there any example how to use Core Data in a modern way with SwiftUI which also includes updating an NSManagedObjectModel?
In the most examples which I found only the create and update steps are described.
I am interested in the update step. Where I present an edit screen. Is it better to create a @State variable for the properties of the NSManagedObjectModel or should I load the NSManagedObjectModel from an child context and edit the properties directly?
Does anyone have some up to date examples or advice for me?
Cheers
Patrick
Hi,
I started developing an iOS app in Swift Playgrounds last year. Now I tried to add a NavigationStack into one of my SwiftUI views. I get the error, that NavigationStack is only available since iOS 16.
If I create a new app project it is possible to use iOS 16 related features.
Is there any way to upgrade existing apps to iOS 16? Like in Xcode (Deployment Target).
I have a small text file which I would like to share via ShareLink with watchOS. If I try to share the text file via Mail oder iMessage the recipient only receives the message without the attachment. The same code works without problems on iOS. Is the is watchOS bug?
Hi,
I started to implement my first App Intent. I have added a parameter (@Parameter). But what data type do I need do set to get a file as input?
Hi,
I have created a TabView with TabViewStyle.page. Is there a way to present the dots on watchOS? I have written some demo watchOS project:
import SwiftUI
@main
struct PageControllerWatchTestApp: App {
var body: some Scene
WindowGroup {
TabView {
Color(.red)
Color(.blue)
Color(.orange)
}.tabViewStyle(.page)
}
}
}
If I try the same code on iOS the dots are presented. Is there a way to enable the dots on watchOS?
I am using watchOS 9 Beta 4 with Xcode 14 Beta 4.
I now watched all 4 charts WWDC22 videos. It looks like there is no pie chart support. Do I need to build such style by myself or is there a way to implement this in the new Swift Charts framework?
Is there a way to set the text color of the new iOS 14 UIDatePicker? If the picker isn’t selected the default text color is black, is there a way to change this. I am able to change the selected text color via the tint color. I use the .inline style and show only the time.
[EDIT]: I can see the Screenshot only in the edit view 😟The version with Screenshots is available here: https://stackoverflow.com/questions/61270644/sirikit-custom-intents-an-localization-problemHi,I have the problem, that Siri always responses with the english version of my intents. I have create a demo project to seperate out the relevant code:I have 3 targets in my project:The .intentsdefinition file is located in the framework (Base) and the classes are generated also there as it was suggested in the WWDC talk (2018 - 211)This file is also translated into the german language:But the problem is, that if I create a shortcut/intent via the app (INUIAddVoiceShortcutViewController viewcontroller) the action name is already in english (should be Hallo not Hello), but as you can see, the whole viewcontroller is localized in german:The strange thing is, if I select the action to see more info, the string inside this view controller is in german.If I add this shortcut to Siri, the info texts are all in german, if I use the Shortcuts.app. If I ask Siri about the state, the response is in german, but the custom response of my shortcut is in english.So does anyone know how I can fix this problem?
I have problem with an iOS app access a file in the Library/Sounds directory.My iOS app delivers different sound files in the main app bundle. I have written some code which copies a selected file into the Library/Sounds directory. It always has the same name (foo.caf) in that directory.This way I am able to switch to different push notification sounds. If I do this the first time everything works fine. But if I switch to an other app and I receive a push notification there is no sound anymore. Also the default sound isn't played. But the strange thing is, that if I reboot the iPhone and I receive a new push notification I get the newly selected sound..Does iOS have some cache or something else, which I have to reset first? Or is this an iOS bug?EDIT:I have written a small demo project to reproduce the problem. It can be found at:Source code: https://github.com/patricks/PushNotificationSoundSwitch/releasesGit Repo: https://github.com/patricks/PushNotificationSoundSwitchReadme file: https://github.com/patricks/PushNotificationSoundSwitch/blob/master/README.md