Posts

Post not yet marked as solved
0 Replies
459 Views
The Timer on WatchKit doesn't execute the lblTimer.setText("(currentTime)") properly when it is there in the function called when the timer fires. What should I do to fix this problem? The label is just static and should be updated very often. Does the watchOS simulator have a bug?Also, I tried the Timer from watckKit and that didn't work either.Here's the sample code where the lblTimer.setText doesn't execute on the screen:@objc func fire() { print(countDown) if (countDown <= 0.0) { timer?.invalidate() speechSynthesizer?.speak(AVSpeechUtterance(string: "You ran out of time! Next question!")) countDown = 30.0 lblTimer.setText("30.0") } else { countDown -= 0.01 let numberOfPlaces = 2.0 let multiplier: Float = Float(pow(10.0, numberOfPlaces)) let num: Float = countDown let rounded = round(num * multiplier) / multiplier lblTimer.setText("Time: \(rounded)") print(rounded) } }
Posted Last updated
.
Post not yet marked as solved
2 Replies
1.4k Views
ViewController.swiftimport UIKit import MapKit class ViewController: UIViewController { @IBOutlet weak var mapView: MKMapView! let regionRadius: CLLocationDistance = 1000 let initiallocation = CLLocation(latitude: 34.0522, longitude: 118.2437) func centerMapOnLocation(location: CLLocation) { let coordinateRegion = MKCoordinateRegion(center: location.coordinate, latitudinalMeters: regionRadius, longitudinalMeters: regionRadius) mapView.setRegion(coordinateRegion, animated: true) } override func viewDidLoad() { super.viewDidLoad() mapView.delegate = self centerMapOnLocation(location: initiallocation) let place = Place(title: "My House", locationName: "Shyamal's House", coordinate2D: CLLocationCoordinate2D(latitude: 37.3769993, longitude: -94.6895241), article: "Shyamal's Favorite Place to B-Ball", similarPlaces: []) mapView.addAnnotation(place) } } extension ViewController: MKMapViewDelegate { func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? { guard let annotation = annotation as? Place else {return nil} let identifier = "marker" var view: MKMarkerAnnotationView if let dequeuedView = mapView.dequeueReusableAnnotationView(withIdentifier: identifier) as Optional { dequeuedView.annotation = annotation view = dequeuedView as! MKMarkerAnnotationView } else { view = MKMarkerAnnotationView(annotation: annotation, reuseIdentifier: identifier) view.canShowCallout = true view.calloutOffset = CGPoint(x: -5, y: 3) view.rightCalloutAccessoryView = UIButton(type: .detailDisclosure) } return view } }Place.swiftimport Foundation import MapKit class Place: NSObject, MKAnnotation { var coordinate: CLLocationCoordinate2D var title: String? var locationName: String? var coordinate2D: CLLocationCoordinate2D? var article: String? var similarPlaces: [CLLocationCoordinate2D]? init(title: String, locationName: String, coordinate2D: CLLocationCoordinate2D, article: String, similarPlaces: [CLLocationCoordinate2D]) { self.title = title self.locationName = locationName self.coordinate2D = coordinate2D self.article = article self.similarPlaces = similarPlaces self.coordinate = coordinate2D super.init() } /* init? (json: [Any]){ //To be Completed super.init() } */ var subtitle: String? { return locationName } }Output (console) at runtime:2019-09-25 09:28:05.596379-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [User Defaults] Couldn't write values for keys ( ApplicationAccessibilityEnabled ) in CFPrefsPlistSource<0x600002c0aa80> (Domain: com.apple.Accessibility, User: kCFPreferencesCurrentUser, ByHost: No, Container: (null), Contents Need Refresh: Yes): setting preferences outside an application's container requires user-preference-write or file-write-data sandbox access 2019-09-25 09:28:05.598361-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [User Defaults] Couldn't write values for keys ( AccessibilityEnabled ) in CFPrefsPlistSource<0x600002c0aa80> (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 2019-09-25 09:28:05.598762-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [User Defaults] Couldn't write values for keys ( FullKeyboardAccessFocusRingEnabled ) in CFPrefsPlistSource<0x600002c0aa80> (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 2019-09-25 09:28:05.602326-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [User Defaults] Couldn't write values for keys ( ApplicationAccessibilityEnabled ) in CFPrefsPlistSource<0x600002c0aa80> (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 2019-09-25 09:28:05.622810-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [AXAppAccessibility] AXSettingsLoader told to start 2019-09-25 09:28:05.771522-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [AXLoading] Accessibility Started 2019-09-25 09:28:05.772208-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [AXLoading] Accessibility Started (Mini-Server) 2019-09-25 09:28:05.772247-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [AXLoading] Accessibility Initialize Runtime Overrides 2019-09-25 09:28:05.776147-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [AXLoading] Accessibility Initialize Subclass Runtime Overrides (UIKit) 2019-09-25 09:28:05.792909-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [AXAppAccessibility] Started AXRuntime server. SystemApp=0 2019-09-25 09:28:05.837823-0500 Primary Operations - Geography Edition (iOS)[2661:83671] Metal API Validation Enabled 2019-09-25 09:28:06.515178-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [MKApplicationStateMonitor] Observer count increased to 1 2019-09-25 09:28:06.515236-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [MKApplicationStateMonitor] Will start monitoring using UIApplicationState with initial state (inBackground:YES, active:NO) 2019-09-25 09:28:06.515440-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [MKLocationManager] Setting location provider [MKCoreLocationProvider](0x600002920850) for 0x10800aba0 2019-09-25 09:28:06.515471-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [MKLocationManager] Shared location manager: 0x10800aba0 2019-09-25 09:28:06.515910-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [MKApplicationStateMonitor] Observer count increased to 2 2019-09-25 09:28:06.862886-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [MKApplicationStateMonitor] Will exit background 2019-09-25 09:28:06.870600-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [MKApplicationStateMonitor] Will become active 2019-09-25 09:28:07.311654-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [MapView] Could not inset compass from edges 12 2019-09-25 09:28:07.311985-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [MapView] Could not inset legal attribution from corner 4 2019-09-25 09:28:07.312214-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [MapView] Could not inset compass from edges 12 2019-09-25 09:28:07.312451-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [MapView] Could not inset legal attribution from corner 4 2019-09-25 09:28:07.312760-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [MapView] Could not inset compass from edges 12 2019-09-25 09:28:07.313020-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [MapView] Could not inset legal attribution from corner 4 2019-09-25 09:28:07.425405-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [MapView] Could not inset compass from edges 12 2019-09-25 09:28:07.425729-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [MapView] Could not inset legal attribution from corner 4 2019-09-25 09:28:07.425930-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [MapView] Could not inset compass from edges 12 2019-09-25 09:28:07.426163-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [MapView] Could not inset legal attribution from corner 4 2019-09-25 09:28:07.432164-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [AXAppAccessibility] Loading settings loader: (system: 0) 2019-09-25 09:28:07.478129-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [UIAutomation] View did appear: <Primary_Operations___Geography_Edition__iOS_.ViewController: 0x10811fbf0> 0 2019-09-25 09:28:07.478394-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [AXAppAccessibility] AXSettingsLoader told to start 2019-09-25 09:28:07.478464-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [AXAppAccessibility] AXSettingsLoader told to start 2019-09-25 09:28:07.478521-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [AXAppAccessibility] AXSettingsLoader told to start 2019-09-25 09:28:09.250869-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [AXLoading] Posted kAXAccessibilityLoaded notification 2019-09-25 09:28:12.622951-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [MKApplicationStateMonitor] Will resign active 2019-09-25 09:28:12.623248-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [BackgroundTask] -[UIApplication _beginBackgroundTaskWithName:expirationHandler:]: Will add backgroundTask with taskName: com.apple.asset_manager.cache_resource_cleanup, expirationHandler: <__NSStackBlock__: 0x7ffeefbf9568> 2019-09-25 09:28:12.623289-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [BackgroundTask] _UIBackgroundTaskInfo *_addBackgroundTask(NSString *__strong, void (^__strong)(void)): Created background task <_UIBackgroundTaskInfo: 0x600000cf4c90>: taskID = 0, taskName = com.apple.asset_manager.cache_resource_cleanup, count = 1, assertion = (null). Assertion will be assigned soon 2019-09-25 09:28:12.623338-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [BackgroundTask] _UIBackgroundTaskInfo *_addBackgroundTask(NSString *__strong, void (^__strong)(void))_block_invoke: Creating new assertion since assertion is nil 2019-09-25 09:28:12.623443-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [BackgroundTask] _UIBackgroundTaskInfo *_addBackgroundTask(NSString *__strong, void (^__strong)(void))_block_invoke: Created new assertion <BKSProcessAssertion: 0x600002171720> 2019-09-25 09:28:12.688465-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [BackgroundTask] -[UIApplication _endBackgroundTask:]: Ending background task with UIBackgroundTaskIdentifier: 1 2019-09-25 09:28:12.688562-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [BackgroundTask] -[UIApplication _endBackgroundTask:]: Ending task with identifier 1 and description: <_UIBackgroundTaskInfo: 0x600000cf4c90>: taskID = 1, taskName = com.apple.asset_manager.cache_resource_cleanup, count = 1, assertion = <BKSProcessAssertion: 0x600002171720>, _expireHandler: <__NSMallocBlock__: 0x600000cf4cc0> 2019-09-25 09:28:12.688599-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [BackgroundTask] -[UIApplication _endBackgroundTask:]_block_invoke: Decrementing reference count for assertion used by background task with identifier 1: <_UIBackgroundTaskInfo: 0x600000cf4c90>: taskID = 1, taskName = com.apple.asset_manager.cache_resource_cleanup, count = 1, assertion = (null) 2019-09-25 09:28:12.688625-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [BackgroundTask] -[UIApplication _endBackgroundTask:]_block_invoke: Will invalidate assertion: <BKSProcessAssertion: 0x600002171720> for task identifier: 1 2019-09-25 09:28:12.688849-0500 Primary Operations - Geography Edition (iOS)[2661:83671] [MKApplicationStateMonitor] Will enter background 2019-09-25 09:28:12.971093-0500 Primary Operations - Geography Edition (iOS)[2661:83671] Lifecycle: Task count reached zero, notifying AppKit side.
Posted Last updated
.
Post not yet marked as solved
1 Replies
475 Views
Is there a very simple sample application that shows how to program and visualize the Siri Remote X, Y, Z location for motion gestures with tvOS? I would like to program the tvOS with the GameController kit to make a motion sensitive app using Siri Remote. All I see online in stackexchange is the following and it is outdated through changes in the API by Apple:https://stackoverflow.com/questions/32832541/how-to-get-motion-events-with-the-apple-tv-remoteAny ideas?
Posted Last updated
.
Post not yet marked as solved
0 Replies
715 Views
I saw the WWDC presentation (https://developer.apple.com/videos/play/wwdc2019/702/) about DriverKit and USBDriverKit. What are the exact step-by-step process to write a driver including the documentation for each function used?
Posted Last updated
.
Post not yet marked as solved
3 Replies
608 Views
import Cocoa import Foundation import AppKit class ViewController: NSViewController, NSSpeechRecognizerDelegate { var speechRec: NSSpeechRecognizer = NSSpeechRecognizer()! var commands = ["a","b","c","d","stop","go"] override func viewDidLoad() { super.viewDidLoad() speechRec.commands = commands speechRec.delegate = self //speechRec.listensInForegroundOnly = true //speechRec.blocksOtherRecognizers = true speechRec.startListening() } override var representedObject: Any? { didSet { // Update the view, if already loaded. } } @IBAction func Listen(_ sender: Any) { speechRec.startListening() print("Listening now...") } @IBAction func Stop(_ sender: Any) { speechRec.stopListening() print("Stopped Listening...") } func speechRecognizer(_ sender: NSSpeechRecognizer, didRecognizeCommand command: String) { print("Recognized...") if (command as String == "a") { print("You picked \(command)") // Debug print } else if (command as String == "b") { print("You picked \(command)") // Debug print } else if (command as String == "c") { print("You picked \(command)") // Debug print } else if (command as String == "d") { print("You picked \(command)") // Debug print } else if (command as String == "stop") { print("You picked \(command)") // Debug print } else if (command as String == "go") { print("You picked \(command)") // Debug print } else { print("You picked \(command)") } } }Any ideas? Basically, the code is supposed to print a message on recognition of the stop words in the commands array. Nothing is being recognized. What should I do?
Posted Last updated
.
Post not yet marked as solved
0 Replies
367 Views
extension Quiz { func speechSynthesizer(_ synthesizer: AVSpeechSynthesizer, didStart utterance: AVSpeechUtterance) { print("AVSpeechSynthesizerDelegate: didStart") doneSpeaking = false } func speechSynthesizer(_ synthesizer: AVSpeechSynthesizer, didFinish utterance: AVSpeechUtterance) { print("AVSpeechSynthesizerDelegate: didFinish") doneSpeaking = true }These extensions are not working to change the flag named doneSpeaking once the speech Synthesizer turns on or off. What should I do?
Posted Last updated
.
Post not yet marked as solved
2 Replies
4.6k Views
What should I do if I am getting these errors in the Error Log?2019-08-13 20:23:33.695075-0500 Test1234[13048:343089] Metal API Validation Enabled 2019-08-13 20:23:37.662001-0500 Test1234[13048:343089] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x600000237f00> F8BB1C28-BAE8-11D6-9C31-00039315CD46 2019-08-13 20:23:38.041097-0500 Test1234[13048:343089] HALC_ShellDriverPlugIn::Open: Can't get a pointer to the Open routine 2019-08-13 20:23:38.043625-0500 Test1234[13048:343089] [ddagg] AggregateDevice.mm:776 couldn't get default input device, ID = 0, err = 0! 2019-08-13 20:23:38.452663-0500 Test1234[13048:343089] [avae] AVAEInternal.h:76 required condition is false: [AVAudioIONodeImpl.mm:1063:SetOutputFormat: (IsFormatSampleRateAndChannelCountValid(hwFormat))] 2019-08-13 20:23:38.484399-0500 Test1234[13048:343089] [General] required condition is false: IsFormatSampleRateAndChannelCountValid(hwFormat) 2019-08-13 20:23:38.566293-0500 Test1234[13048:343089] [General] ( 0 CoreFoundation 0x00007fff31678183 __exceptionPreprocess + 250 1 libobjc.A.dylib 0x00007fff67b82b64 objc_exception_throw + 48 2 CoreFoundation 0x00007fff31693a50 +[NSException raise:format:arguments:] + 88 3 AVFAudio 0x00007fff2d1cef87 _Z19AVAE_RaiseExceptionP8NSStringz + 156 4 AVFAudio 0x00007fff2d1ceea4 _Z11_AVAE_CheckPKciS0_S0_b + 326 5 AVFAudio 0x00007fff2d24f078 _ZN17AVAudioIONodeImpl15SetOutputFormatEmP13AVAudioFormat + 306 6 AVFAudio 0x00007fff2d1e7a5f _ZN17AUGraphNodeBaseV318CreateRecordingTapEmjP13AVAudioFormatU13block_pointerFvP16AVAudioPCMBufferP11AVAudioTimeE + 251 7 AVFAudio 0x00007fff2d23ee0d _ZN18AVAudioEngineGraph16InstallTapOnNodeEP11AVAudioNodemjP13AVAudioFormatU13block_pointerFvP16AVAudioPCMBufferP11AVAudioTimeE + 389 8 AVFAudio 0x00007fff2d25a887 _ZN17AVAudioEngineImpl16InstallTapOnNodeEP11AVAudioNodemjP13AVAudioFormatU13block_pointerFvP16AVAudioPCMBufferP11AVAudioTimeE + 391 9 AVFAudio 0x00007fff2d2449fe -[AVAudioNode installTapOnBus:bufferSize:format:block:] + 205 10 Test1234 0x0000000100002431 $s8Test123414ViewControllerC24recordAndRecognizeSpeechyyF + 465 11 Test1234 0x000000010000217a $s8Test123414ViewControllerC18startButtonPressedyyypF + 58 12 Test1234 0x00000001000021d0 $s8Test123414ViewControllerC18startButtonPressedyyypFTo + 80 13 AppKit 0x00007fff2eadda14 -[NSApplication(NSResponder) sendAction:to:from:] + 299 14 AppKit 0x00007fff2eb3ca18 -[NSControl sendAction:to:] + 86 15 AppKit 0x00007fff2eb3c94a __26-[NSCell _sendActionFrom:]_block_invoke + 136 16 AppKit 0x00007fff2eb3c84c -[NSCell _sendActionFrom:] + 171 17 AppKit 0x00007fff2eb65527 -[NSButtonCell _sendActionFrom:] + 96 18 AppKit 0x00007fff2eecb614 NSControlTrackMouse + 1745 19 AppKit 0x00007fff2eb3b268 -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 130 20 AppKit 0x00007fff2eb65290 -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 691 21 AppKit 0x00007fff2eb3a503 -[NSControl mouseDown:] + 748 22 AppKit 0x00007fff2ea2d259 -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 4907 23 AppKit 0x00007fff2e970968 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 2612 24 AppKit 0x00007fff2e96fcf5 -[NSWindow(NSEventRouting) sendEvent:] + 349 25 AppKit 0x00007fff2e831b54 -[NSApplication(NSEvent) sendEvent:] + 352 26 AppKit 0x00007fff2e821527 -[NSApplication run] + 707 27 AppKit 0x00007fff2e8133de NSApplicationMain + 777 28 Test1234 0x00000001000048bd main + 13 29 libdyld.dylib 0x00007fff68ed82f5 start + 1 30 ??? 0x0000000000000003 0x0 + 3 )Thank you!I already set up the Info.plist and put the desired functions and outlets and actions. Any ideas about an example for an different setups from an iOS version of the same app with the following code?https://medium.com/ios-os-x-development/speech-recognition-with-swift-in-ios-10-50d5f4e59c48
Posted Last updated
.