Post

Replies

Boosts

Views

Activity

FoundationModels tool calling not working (iOS 26, beta 6)
I have a fairly basic prompt I've created that parses a list of locations out of a string. I've then created a tool, which for these locations, finds their latitude/longitude on a map and populates that in the response. However, I cannot get the language model session to see/use my tool. I have code like this passing the tool to my prompt: class Parser { func populate(locations: String, latitude: Double, longitude: Double) async { let findLatLonTool = FindLatLonTool(latitude: latitude, longitude: longitude) let session = LanguageModelSession(tools: [findLatLonTool]) { """ A prompt that populates a model with a list of locations. """ """ Use the findLatLon tool to populate the latitude and longitude for the name of each location. """ } let stream = session.streamResponse(to: "Parse these locations: \(locations)", generating: ParsedLocations.self) let locationsModel = LocationsModels(); do { for try await partialParsedLocations in stream { locationsModel.parsedLocations = partialParsedLocations.content } } catch { print("Error parsing") } } } And then the tool that looks something like this: import Foundation import FoundationModels import MapKit struct FindLatLonTool: Tool { typealias Output = GeneratedContent let name = "findLatLon" let description = "Find the latitude / longitude of a location for a place name." let latitude: Double let longitude: Double @Generable struct Arguments { @Guide(description: "This is the location name to look up.") let locationName: String } func call(arguments: Arguments) async throws -> GeneratedContent { let request = MKLocalSearch.Request() request.naturalLanguageQuery = arguments.locationName request.region = MKCoordinateRegion( center: CLLocationCoordinate2D(latitude: latitude, longitude: longitude), latitudinalMeters: 1_000_000, longitudinalMeters: 1_000_000 ) let search = MKLocalSearch(request: request) let coordinate = try await search.start().mapItems.first?.location.coordinate if let coordinate = coordinate { return GeneratedContent( LatLonModel(latitude: coordinate.latitude, longitude: coordinate.longitude) ) } return GeneratedContent("Location was not found - no latitude / longitude is available.") } } But trying a bunch of different prompts has not triggered the tool - instead, what appear to be totally random locations are filled in my resulting model and at no point does a breakpoint hit my tool code. Has anybody successfully gotten a tool to be called?
2
1
313
2w
Live activities on watchOS not working on simulator
Is there a trick to getting the new Live Activities on Apple Watch working via the simulator? I have an iPhone paired to a watch simulator, but live activities created on the phone aren't appearing on the watch Smart Stack. It looks like maybe the Smart Stack isn't functional on the watch simulator, as there are a bunch of blank tiles where the Smart Stack should be.
3
5
1k
Sep ’24
Donating App Intent with parameters (iOS 16 beta)
Has anybody managed to use the new IntentDonationManager to donate an intent which has a number of parameters defined with @Parameter? For example, given this snippet: struct MyIntent: AppIntent { ...     @Parameter(title: "MyParameter")     var parameter: MyParameter ... } When you use the constructor, the arguments are of type IntentParameter<MyParameter> rather than MyParameter. How do you actually create an instance of IntentParameter to pass into the constructor?
1
0
2.2k
Aug ’22
iPhone Simulator – Apple Watch Is Syncing (Xcode 11 Beta 7)
Currently runnning XCode 11 Beta 7, and trying to test out iCloud based functionality with an Apple Watch paired to an iPhone.However, when I open the watch settings app on the paired phone, it immediately displayed the screen saying that the "Apple Watch Is Syncing" and to come back later. But this never finishes.I have tried deleting simulators and re-pairing the Apple Watch but nothing seems to change this behaviour - even though the Watch is working and apparently paired, I cannot access the settings app.Is this expected behaviour? Have I done something wrong?
4
0
4.3k
Sep ’21
Xcode 11 Indexing
After a day or so of using Xcode 11, all of my projects have gotten into a state where they are just stuck on "Indexing" infinitely. It doesn't appear to be project specific as even making a new project has the same effect.Obviously a beta, but does anybody have any workarounds? I've tried all the usual tricks to delete DerivedData and caches, reboots, etc. and nothing seems to have worked.
7
0
14k
Feb ’21
Widget configuration selection hangs
I followed the instructions here to configure a Widget with dynamic configuration: https://developer.apple.com/documentation/widgetkit/making-a-configurable-widget The list of items is populated correctly, but when I select an item, and dismiss the selection screen, the selection screen does go away, but the screen stays on the blurred background and the widget does not flip back around. Has anybody seen this before? There doesn't seem to be any error occurring and there's no code being executed in either the intent handler or widget extension.
1
0
850
Jan ’21