Posts

Post not yet marked as solved
0 Replies
457 Views
Can I make a ranking list of some type with friends using CloudKit? I invite friend A and B. I can see the rankings of friend A and friend B. Friend A can see my ranking. Friend B can see my ranking. Friend B cannot see ranking of Friend A (and vice versa) unless it has shares its ranking with the other.
Posted
by LH16.
Last updated
.
Post not yet marked as solved
4 Replies
1.9k Views
Can I use Screen Time's Managed Settings to block access to certain apps on just my device, without the parent control part because the user creates a setup for themselves and for their own device?
Posted
by LH16.
Last updated
.
Post not yet marked as solved
0 Replies
747 Views
When the JSON file with all the rules is changed from the container app do you need to reload the content blocker like you need to do in Safari? If yes, how do you reload? And can you get the content blocker activation status?
Posted
by LH16.
Last updated
.
Post marked as solved
1 Replies
856 Views
Can you get a list of all the focus types? And subscribe to notification when the users or system on behalve of the user changes to a different Focus type? Would like to change something in my app to adapt to which Focus type the user is on.
Posted
by LH16.
Last updated
.
Post marked as solved
2 Replies
881 Views
I have trouble with reading a file from an App Group with my System Network Extension. The app group container is found successfully. However the file read returns empty. In the app itself the same code runs fine and returns a string array of items found in the file. Code: func readFile() - [String] {         var jsonResult: [String] = []         guard let containerURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: AppConstants.groupID) else {             fatalError()         }         let fileURL = containerURL.appendingPathComponent("file.json")         if let data = try? NSData(contentsOfFile: fileURL.path, options: .mappedIfSafe) as Data {             if let json = try? JSONSerialization.jsonObject(with: data, options: .fragmentsAllowed) {                 jsonResult = json as! [String]             }         }         os_log("jsonResult: %{public}@", jsonResult)         return jsonResult     } Log: default 09:42:19.486793+0200 app-network-extension container_create_or_lookup_app_group_path_by_app_group_ identifier: success default 09:42:20.105792+0200 app-network-extension jsonResult: ( ) Edit, after more digging: fileURL is different! App: file:///Users/me/Library/Group%20Containers/ SysExt: file:///private/var/root/Library/Group%20Containers/
Posted
by LH16.
Last updated
.
Post marked as solved
1 Replies
960 Views
I have an array of activities that need to be run at a specific time. The run in a background helper app. The array is sorted on date/time. At 12:08:51 I add a new item in the array.. to run at 12:12. Upon creation the array is sorted again and the closest is added as an activity to a NSBackgroundActivityScheduler. However it runs at creation and a few times more before 12:12. The next automation Normal doesn't run at creation as activity (activity Normal is already in the array of activities). Why is this happening? And how can I fix it? Log: 12:12:15.664819+0200 Next Automation Normal on 2021-04-15 08:50:00 +0000 Code: }
Posted
by LH16.
Last updated
.
Post not yet marked as solved
0 Replies
791 Views
I have a Swift Package with shared code. With Xcode's SPM added to my Xcode project. Works great in the main app. Doesn't work in the helper app when exported. Running the helper app in Xcode itself works fine. But when running as an exported and signed app it doesn't work. This error message was found in console: Fatal error: unable to find bundle named MySwiftPackageName: file MySwiftPackageName/resource_bundle_accessor.swift, line 27 I double checked, the package is really added at Build Phase - Link Binary With Libraries When I inspect the exported main app and helper app I found the package in the main resources folder but not in the helper app resources folder. How can I fix this?
Posted
by LH16.
Last updated
.
Post not yet marked as solved
0 Replies
1.5k Views
.contextMenu {} is not working for me in my tvOS app. It is supported in tvOS 14 https://developer.apple.com/documentation/swiftui/view/contextmenu(menuitems:) Someone an idea how to get it working? Example import SwiftUI struct NumberItem: Identifiable, Hashable {     var id = UUID()     var number: String } struct ContentView: View {     let array: [NumberItem] = [NumberItem(number: "423"),                                NumberItem(number: "645"),                                NumberItem(number: "213"),                                NumberItem(number: "975"),                                NumberItem(number: "357"),                                NumberItem(number: "950"),                                NumberItem(number: "043"),                                NumberItem(number: "174")]     let columns = [GridItem(.adaptive(minimum: 300.0, maximum: 800.0))]     var body: some View {         ScrollView {             LazyVGrid(columns: columns, spacing: 20) {                 ForEach(array, id: \.id) { item in                     ItemView(item: item)                         .contentShape(RoundedRectangle(cornerRadius: 12, style: .continuous))                         .contextMenu {                             // Edit                             Button(action: {                                 print("Edit")                             }) {                                 Text("Edit")                                 Image(systemName: "square.and.pencil")                             }                             // Delete                             Button(action: {                                 print("Delete")                             }) {                                 Text("Delete")                                 Image(systemName: "trash")                             }                         }                 }             }         }     } } struct ItemView: View {     @State private var focused: Bool = false     @State var item: NumberItem     var body: some View {         Group {             Text("Item \(item.number)")                 .padding()         }         .padding()         .background(Color.pink)         .cornerRadius(12)         .scaleEffect(self.focused ? 1.20 : 1.00)         .shadow(radius: 10)         .focusable(true) { isFocused in             withAnimation(.easeInOut(duration:0.3)) {                 self.focused = isFocused             }         }     } } struct ContentView_Previews: PreviewProvider {     static var previews: some View {         ContentView()     } } Full project: https://github.com/l1ghthouse/TVContextMenu
Posted
by LH16.
Last updated
.
Post marked as solved
1 Replies
3.9k Views
I have a list with items that contain a title and a date. User can set what to sort on (title or date). However I can't figure out how to change the NSSortDescriptor dynamically. import SwiftUI import CoreData struct ContentView: View { @Environment(\.managedObjectContext) private var viewContext @FetchRequest(sortDescriptors: [NSSortDescriptor(keyPath: \Test.title, ascending: true)], animation: .default) private var items: FetchedResults<Test> @State private var sortType: Int = 0 @State private var sortDescriptor: NSSortDescriptor = NSSortDescriptor(keyPath: \Test.title, ascending: true) var body: some View { Picker(selection: $sortType, label: Text("Sort")) { Text("Title").tag(0) Text("Date").tag(1) } .pickerStyle(SegmentedPickerStyle()) .onChange(of: sortType) { value in sortType = value if sortType == 0 { sortDescriptor = NSSortDescriptor(keyPath: \Test.title, ascending: true) } else { sortDescriptor = NSSortDescriptor(keyPath: \Test.date, ascending: true) } } List { ForEach(items) { item in let dateString = itemFormatter.string(from: item.date!) HStack { Text(item.title!) Spacer() Text(dateString) } } } .onAppear(perform: { if items.isEmpty { let newEntry1 = Test(context: self.viewContext) newEntry1.title = "Apple" newEntry1.date = Date(timeIntervalSince1970: 197200800) let newEntry2 = Test(context: self.viewContext) newEntry2.title = "Microsoft" newEntry2.date = Date(timeIntervalSince1970: 168429600) let newEntry3 = Test(context: self.viewContext) newEntry3.title = "Google" newEntry3.date = Date(timeIntervalSince1970: 904903200) let newEntry4 = Test(context: self.viewContext) newEntry4.title = "Amazon" newEntry4.date = Date(timeIntervalSince1970: 773402400) if self.viewContext.hasChanges { try? self.viewContext.save() } } }) } } private let itemFormatter: DateFormatter = { let formatter = DateFormatter() formatter.dateStyle = .short formatter.timeStyle = .none return formatter }() When I change @FetchRequest(sortDescriptors: [NSSortDescriptor(keyPath: \Test.title, ascending: true)], animation: .default) private var items: FetchedResults<Test> to @FetchRequest(sortDescriptors: [sortDescriptor], animation: .default) private var items: FetchedResults<Test> the error "Cannot use instance member 'sortDescriptor' within property initializer; property initializers run before 'self' is available" appears. I also tried to store the NSSortDescriptor in a UserDefault and create an init that creates it's own FetchRequest.. still no dynamic sorting... Anyone a pointer where to look to solve this problem? Whole project found here: https://github.com/l1ghthouse/FRDSD
Posted
by LH16.
Last updated
.
Post not yet marked as solved
1 Replies
1.9k Views
Is it allowed to use SF Symbols outside the app? For example on the marketing webpage or in videos to indicate features from the app. #FB7781864
Posted
by LH16.
Last updated
.
Post not yet marked as solved
0 Replies
750 Views
"Apple Maps editors have worked with trusted brands and partners to offer Guides for great places around the world to eat, shop, and explore. >>> Guides in Maps will be available for cities including San Francisco, New York, London, and Los Angeles." How can you sign up as a trusted partner for Apple Maps Guides? And could that also be for other cities... or only those mentioned?
Posted
by LH16.
Last updated
.