Post

Replies

Boosts

Views

Activity

Currency Formatter doesn't execute when .resignFirstResponder occurs
I am working on a setup screen with a dollar value and a picker. I have the dollar value setup with a currencyFormatter, and a .keyboardType(.decimalPad), if the user touches outside of the field, the .resignFirstResponder doesn't happen, so I added it to my Picker. However, If the user touches the picker, the .currencyFormatter is not applied.  private var currencyFormatter: NumberFormatter = {         let formatter = NumberFormatter()         formatter.isLenient = true         formatter.numberStyle = .currency         return formatter     }()     var body: some View {         GeometryReader { geometry in             VStack{                 VStack{                     HStack{                         Text("Burden Rate: ")                             .padding(.trailing)                         Spacer()                         TextField("Enter Burden Rate",                                   value: $meetingSetup.saveRateValue,                                   formatter: currencyFormatter,                                   onEditingChanged: {_ in                                     logger.log("editing changed")                                   },                                   onCommit: {                                     logger.log("updated")                                   }                         )                         .textFieldStyle(RoundedBorderTextFieldStyle())                         .multilineTextAlignment(.trailing)                         .padding(.leading)                         .keyboardType(.decimalPad)                     }                     HStack{                         Text("Select One: ")                         Spacer()                         Picker("Calculation", selection: $selectedRateCalc) {                             ForEach( 0 ..< rateCalc.count) {                                 Text(self.rateCalc[$0]).tag($0)                             }                         }                         .pickerStyle(SegmentedPickerStyle())                         .onChange(of: selectedRateCalc, perform: { value in                             switch selectedRateCalc {                             case 0:                                 meetingSetup.hourlyEnabled = false                                 meetingSetup.salaryEnabled = true                                 print("Salary Selected")                             case 1:                                 meetingSetup.hourlyEnabled = true                                 meetingSetup.salaryEnabled = false                                 print("Hourly Selected")                             default:                                 print("ERROR")                             }                             self.hideKeyboard()                         })                     }                 }             }             Spacer()         }     } } #if canImport(UIKit) extension View {     func hideKeyboard() {     UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)     } } #endif I've reduced some of the other screen to make this cleaner for review. How can I correctly clear the keyboard AND have it format the currency correctly. Thanks!
0
0
508
Aug ’20
Can't debug Failed Shortcut Intent Launch.
I've been trying to use the console to debug a problem with my SiriKit Intent which I added to launch my app from short cuts. The Log messages are as follows: error 21:39:20.087846-0400 intents_helper +[INUIImageSizeProvider downscaledPNGImageForImage:size:error:] Non-fatal error: Error Domain=IntentsErrorDomain Code=6009 "Scaled size is larger than image size" UserInfo={NSDebugDescription=Scaled size is larger than image size} error 21:39:20.090408-0400 Shortcuts -[INCache cacheableObjectForIdentifier:] Unable to find cacheable object with identifier intents-remote-image-proxy:?proxyIdentifier=82C0975C-D3F9-69E5-6F55-7E4EBEE3F41A.png&amp;storageServiceIdentifier=com.apple.Intents.INImageServiceConnection in cache. error 21:39:20.096812-0400 Shortcuts _INCExtensionManagerFetchMatchingSiriExtensionForIntent_block_invoke_2 Failed to find extension Error Domain=INExtensionMatchingErrorDomain Code=3001 "(null)" UserInfo={ExtensionPointName=com.apple.intents-service} error 21:39:20.100112-0400 Shortcuts -[WFAction runWithInput:userInterface:parameterInputProvider:variableSource:completionHandler:]_block_invoke Action &lt;WFHandleCustomIntentAction: 0x7f81bec560c0, identifier: com.theapapp.wastedtime.StartMeetingIntent, parameters: 2&gt; finished with error {domain: WFIntentExecutorErrorDomain, code: 100}. Error Domain=WFIntentExecutorErrorDomain Code=100 "There was a problem with the app." UserInfo={NSUnderlyingError=0x6000020fecd0 {Error Domain=INExtensionMatchingErrorDomain Code=3001 "(null)" UserInfo={ExtensionPointName=com.apple.intents-service}}, NSLocalizedFailureReason=Could not run Start a meeting, NSLocalizedDescription=There was a problem with the app.} error 21:39:20.134294-0400 intents_helper bundleProxyForPID No bundleProxy for bundleURL=file:///Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/libexec/ error 21:39:20.185873-0400 coreduetd error in setObject {     DKObjUUID = "ABF04557-70CC-4257-915F-834F529DCB8B";     class = INRunWorkflowIntent;     direction = 0;     donatedBySiri = 0;     handlingStatus = 0;     sourceBundleID = "com.apple.shortcuts";     sourceItemID = "FC884509-AE97-4BAB-97C8-B7B8CFFAC879";     type = Workflow;     verb = RunWorkflow; } for keyPath /device/intents/dataDictionary : Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.coreduetd.context was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.coreduetd.context was invalidated.} My App has an intent handler that calls that intent as follows: override func handler(for intent: INIntent) -> Any {         logger.log("\(intent)")         switch intent {         case is StartMeetingIntent:             return StartMeetingIntentHandler()         default:             fatalError("No handler for this intent")         }     }      And my Intent is defined as follows: import Intents import SwiftUI import os class StartMeetingIntentHandler: NSObject, StartMeetingIntentHandling {     let logger=Logger(subsystem: "com.theapapp.wastedtime", category: "Start Meeting Intent")     var people: [INObject]?     func handle(intent: StartMeetingIntent, completion: @escaping (StartMeetingIntentResponse) -> Void) {         if let attendees = intent.people { completion(StartMeetingIntentResponse.success(result: attendees))         } else {             logger.log("failure")         }     }     func resolvePeople(for intent: StartMeetingIntent, with completion: @escaping (StartMeetingPeopleResolutionResult) -> Void) {         let people = Int(truncating: intent.people ?? 0)         if people < 0 { completion(StartMeetingPeopleResolutionResult.unsupported(forReason: StartMeetingPeopleUnsupportedReason.negativeNumbersNotSupported))         } else if people > 1000 { completion(StartMeetingPeopleResolutionResult.unsupported(forReason: StartMeetingPeopleUnsupportedReason.greaterThanMaximumValue))         } else { completion(StartMeetingPeopleResolutionResult.success(with: people))         }     } } In the Build for the extension the Intent is listed under Supported Intents. (as StartMeetingIntent). And the Extension is embedded in my application. I am stumped.. so any pointers on what I should look at next would be greatly appreciated. Thanks!
7
0
5.0k
Jun ’20
How to override safe area on Widget
I have taken a simple view in my app and made a widget from it; however, the background gradient color I use does not fill the entire widget, it leaves a white band at the top and bottom.     var entry: Provider.Entry     var body: some View {         HStack {             VStack {                 Text("Wasted Time")                     .fontWeight(.bold)                 LifetimeTotalsView()             }         }         .foregroundColor(.black)         .background(LinearGradient(gradient: Gradient(colors: [ .red,.orange,.yellow,.green, .blue, .purple]), startPoint: .top, endPoint: .bottom))     } } I assume these bands relate to the safe area for the widget. How can I expand to fill the entire widget? Thanks
3
0
1.7k
Jun ’20
Shortcut Extension in Catalyst App Build
I have an Intent handler that is used on iOS in shortcuts for my app. The app is also a Catalyst app, but when I try to build it with the Extension I get the following message. error: Embedded binary's bundle identifier is not prefixed with the parent app's bundle identifier. I am assuming that I cannot include the extension in Catalyst, is that true in iOS14?
3
0
1.6k
Jun ’20
App crashes Springboard when IntentHandler embedded
I've been working on adding shortcuts to my app. The Intent handler extension causes my app to crash when it is embedded in the app. I am looking for any guidance on how to debug this, as I went to the Shortcuts Lab and the code was deemed correct. //  IntentHandler.swift //  SiriExtension import Intents class IntentHandler: INExtension, INSendMessageIntentHandling, INSearchForMessagesIntentHandling {     override func handler(for intent: INIntent) -> Any {         // This is the default implementation.  If you want different objects to handle different intents,         // you can override this and return the handler you want for that particular intent.         switch intent {         case is AddAttendeeIntent:             return AddAttendeeIntentHandler()         case is RemoveAttendeeIntent:             return RemoveAttendeeIntentHandler()         case is StartMeetingIntent:             return StartMeetingIntentHandler()         case is EndMeetingIntent:             return EndMeetingIntent()         case is ResetMeetingIntent:             return ResetMeetingIntent()         case is QuorumReachedIntent:             return QuorumReachedIntent()         default:             fatalError("No handler for this intent")         }     }     func resolveRecipients(for intent: INSendMessageIntent, with completion: @escaping ([INSendMessageRecipientResolutionResult]) -> Void) {         if let recipients = intent.recipients {             // If no recipients were provided we'll need to prompt for a value.             if recipients.count == 0 {   completion([INSendMessageRecipientResolutionResult.needsValue()])                 return             }             var resolutionResults = [INSendMessageRecipientResolutionResult]()             for recipient in recipients {                 let matchingContacts = [recipient] // Implement your contact matching logic here to create an array of matching contacts                 switch matchingContacts.count {                 case 2  ... Int.max:                     // We need Siri's help to ask user to pick one from the matches.                     resolutionResults += [INSendMessageRecipientResolutionResult.disambiguation(with: matchingContacts)]                 case 1:                     // We have exactly one matching contact                     resolutionResults += [INSendMessageRecipientResolutionResult.success(with: recipient)]                 case 0:                     // We have no contacts matching the description provided                     resolutionResults += [INSendMessageRecipientResolutionResult.unsupported()]                 default:                     break                 }             }             completion(resolutionResults)         }     }     func resolveContent(for intent: INSendMessageIntent, with completion: @escaping (INStringResolutionResult) -> Void) {         if let text = intent.content, !text.isEmpty {             completion(INStringResolutionResult.success(with: text))         } else {             completion(INStringResolutionResult.needsValue())         }     }     // Once resolution is completed, perform validation on the intent and provide confirmation (optional).     func confirm(intent: INSendMessageIntent, completion: @escaping (INSendMessageIntentResponse) -> Void) {         // Verify user is authenticated and your app is ready to send a message.         let userActivity = NSUserActivity(activityType: NSStringFromClass(INSendMessageIntent.self))         let response = INSendMessageIntentResponse(code: .ready, userActivity: userActivity)         completion(response)     }     // Handle the completed intent (required).     func handle(intent: INSendMessageIntent, completion: @escaping (INSendMessageIntentResponse) -> Void) {         // Implement your application logic to send a message here.         let userActivity = NSUserActivity(activityType: NSStringFromClass(INSendMessageIntent.self))         let response = INSendMessageIntentResponse(code: .success, userActivity: userActivity)         completion(response)     }         // MARK: - INSearchForMessagesIntentHandling     func handle(intent: INSearchForMessagesIntent, completion: @escaping (INSearchForMessagesIntentResponse) -> Void) {         // Return success to launch your Watch application with userActivity containing information for the message search on the interaction.         let userActivity = NSUserActivity(activityType: NSStringFromClass(INSearchForMessagesIntent.self))         let response = INSearchForMessagesIntentResponse(code: .success, userActivity: userActivity)         completion(response)     } }
2
0
697
Jun ’20
Can't get placeholderView .isPlaceHolder(true) working.
I noticed that the downloaded code had intents setup, so changed the code to be StaticConfiguration. everything worked the correctly, however when I tried to add in the .isPlaceHolder(true) I get the message that it is not valid, Here's the code: import WidgetKit import SwiftUI import Intents struct Provider: TimelineProvider {     public func snapshot(with context: Context, completion: @escaping (SimpleEntry) -> ()) {         let entry = SimpleEntry(date: Date(), character: .panda)         completion(entry)     }     public func timeline(with context: Context, completion: @escaping (Timeline&lt;Entry&gt;) -> ()) {         let entries: [SimpleEntry] = [SimpleEntry(date: Date(), character: .panda)]         let timeline = Timeline(entries: entries, policy: .atEnd)         completion(timeline)     } } struct SimpleEntry: TimelineEntry {     public let date: Date     let character: CharacterDetail } struct PlaceholderView : View {     var body: some View {         AvatarView(.panda)         .isPlaceHolder(true) /* ERROR - Value of type 'AvatarView' has no member 'isPlaceHolder' */     } } struct EmojiRangerWidgetEntryView : View {     var entry: Provider.Entry     var body: some View {         AvatarView(entry.character)     } } @main struct EmojiRangerWidget: Widget {     private let kind: String = "EmojiRangerWidget"     public var body: some WidgetConfiguration {         StaticConfiguration(kind: kind, provider: Provider(), placeholder: PlaceholderView()) { entry in             EmojiRangerWidgetEntryView(entry: entry)         }         .configurationDisplayName("Emoji Rangers Detail")         .description("Keep track of your favorite emoji ranger.")         .supportedFamilies([.systemSmall])     } } struct EmojiRangerWidget_Previews: PreviewProvider {     static var previews: some View {         Group {             AvatarView(.panda )                 .previewContext(WidgetPreviewContext(family: .systemSmall))             PlaceholderView()                 .previewContext(WidgetPreviewContext(family: .systemSmall))         }     } }
3
0
904
Jun ’20
Springboard Crashing in Simulator after Attaching Intent Extension
I am getting the following error when I try launching my iPhone app in the simulator. I had just finished a SiriKit Lab session and the last thing that was done was helping me "attach" the extension I was creating. I have since rebooted, etc. but it is happening every time. Any ideas how to remove the attached session, or is this something else? Path:&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/CoreServices/SpringBoard.app/SpringBoard Identifier:&#9;&#9;&#9;&#9;&#9;&#9;SpringBoard Version:&#9;&#9;&#9;&#9;&#9;&#9;&#9; 1.0 (50) Code Type:&#9;&#9;&#9;&#9;&#9;&#9; X86-64 (Native) Parent Process:&#9;&#9;&#9;&#9;launchd_sim [800] Responsible:&#9;&#9;&#9;&#9;&#9; SimulatorTrampoline [746] User ID:&#9;&#9;&#9;&#9;&#9;&#9;&#9; 501 Date/Time:&#9;&#9;&#9;&#9;&#9;&#9; 2020-06-24 15:49:40.114 -0400 OS Version:&#9;&#9;&#9;&#9;&#9;&#9;Mac OS X 10.16 (20A4299v) Report Version:&#9;&#9;&#9;&#9;12 Bridge OS Version:&#9;&#9; 5.0 (18P50310o) Anonymous UUID:&#9;&#9;&#9;&#9;627D7A1F-DDFC-8DCE-8ACF-0ECBAB9020EA
4
0
1.9k
Jun ’20
CallbackURL error in Catalyst
My Catalyst app seems to be having an issue when coming back from Twitter Authentication. The code works fine on iOS, but the app crashes on the Mac. Here's the detailed error information:=================Process: Wasted Time [82621]Path: /Users/USER/*/Wasted Time.app/Contents/MacOS/Wasted TimeIdentifier: maccatalyst.com.theapapp.wastedtimeVersion: 9.1 (11)Code Type: X86-64 (Native)Parent Process: ??? [1]Responsible: Wasted Time [82621]User ID: 501Date/Time: 2020-05-25 12:26:22.676 -0400OS Version: Mac OS X 10.15.5 (19F94a)Report Version: 12Bridge OS Version: 4.5 (17P55289a)Anonymous UUID: 0826D513-91D4-9EDF-EA2C-3EA562E46A48Time Awake Since Boot: 140000 secondsSystem Integrity Protection: enabledCrashed Thread: 0 Dispatch queue: com.apple.main-threadException Type: EXC_CRASH (SIGABRT)Exception Codes: 0x0000000000000000, 0x0000000000000000Exception Note: EXC_CORPSE_NOTIFYApplication Specific Information:Couldn't register maccatalyst.com.theapapp.wastedtime.gsEvents with the bootstrap server. Error: unknown error code (1100).This generally means that another instance of this process was already running or is hung in the debugger.abort() calledThread 0 Crashed:: Dispatch queue: com.apple.main-thread0 libsystem_kernel.dylib 0x00007fff6e14b33a __pthread_kill + 101 libsystem_pthread.dylib 0x00007fff6e207e60 pthread_kill + 4302 libsystem_c.dylib 0x00007fff6e0d2808 abort + 1203 com.apple.GraphicsServices 0x00007fff568b49ca _GSRegisterPurpleNamedPortInPrivateNamespace + 3944 com.apple.GraphicsServices 0x00007fff568b4837 GSRegisterPurpleNamedPort + 235 com.apple.GraphicsServices 0x00007fff568b4322 _GSEventInitializeApp + 2906 com.apple.GraphicsServices 0x00007fff568b41f4 GSEventInitialize + 367 com.apple.UIKitCore 0x00007fff7495bf4f UIApplicationMain + 13948 maccatalyst.com.theapapp.wastedtime 0x00000001096a3eea main + 58 (AppDelegate.swift:14)9 libdyld.dylib 0x00007fff6e003cc9 start + 1================Xcode then gives the following error:2020-05-25 12:26:22.521054-0400 Wasted Time[82077:930719] [assertion] Error acquiring assertion: &lt;NSError: 0x600000d7dbf0; domain: RBSAssertionErrorDomain; code: 2; reason: "Specified target process does not exist"&gt;
4
0
1.4k
May ’20
Catalyst App and Userdefaults
I've created a Catalyst app that runs on WatchOS, iOS, iPadOS and MacOS. It stores some basic data in UserDefaults using Combine. The latest builds are starting to get the following error.2020-05-25 12:10:30.535305-0400 Wasted Time[82077:918516] [User Defaults] Couldn't write values for keys ( ApplicationAccessibilityEnabled ) in CFPrefsPlistSource&lt;0x600002c15f00&gt; (Domain: com.apple.Accessibility, User: kCFPreferencesCurrentUser, ByHost: No, 2020-05-25 12:10:30.538688-0400 Wasted Time[82077:918516] [User Defaults] Couldn't write values for keys ( AccessibilityEnabled ) in CFPrefsPlistSource&lt;0x600002c15f00&gt; (Domain: com.apple.Accessibility, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access 2020-05-25 12:10:30.539074-0400 Wasted Time[82077:918516] [User Defaults] Couldn't write values for keys ( FullKeyboardAccessFocusRingEnabled ) in CFPrefsPlistSource&lt;0x600002c15f00&gt; (Domain: com.apple.Accessibility, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access 2020-05-25 12:10:30.540987-0400 Wasted Time[82077:918516] [User Defaults] Couldn't write values for keys ( ApplicationAccessibilityEnabled ) in CFPrefsPlistSource&lt;0x600002c15f00&gt; (Domain: com.apple.Accessibility, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: No): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access Container: (null), Contents Need Refresh: Yes): setting preferences outside an application's container requires useI I haveI have cofirmed that my App Sandbox settings are showing "File Access -&gt; User Selected File -&gt; Read/Write". The app has a custom suiteName for my UserDefaults, and apprears to actually make the updates. (I do see this error in both Xcode 11 and Xcode 11.5(11E608c).How do I resolve this error?
9
1
3.9k
May ’20
Submit App without Watch Components
I am in the process of building my first Watch app as an extension of my iPhone App. I am having problems with the Watch app, but would like to submit the updates I have made for my iOS app. Is there a best practice or guide to help me submit my iPhone app, without the embedded watch components. Right now, iTunes Connect keeps including my watch App, which is not ready, and therefore won't let me submit my app for review.Thanks
2
0
756
Sep ’15