apple-watch

Watch Complication causes crash with dyld: Symbol not found: _OBJC_CLASS_$_CLKFullColorImageProvider

我的未来我决定 提交于 2019-12-04 05:20:01
问题 I'm getting this error dyld: Symbol not found: _OBJC_CLASS_$_CLKFullColorImageProvider in watchOS 4 but not in watchOS 5, I believe it's related to my complication code below but can't figure out why...as far as I can tell the compiler shouldn't be looking for CLKFullColorImageProvider as I've blocked that off with if #available(watchOSApplicationExtension 5.0, *) class Complication: NSObject, CLKComplicationDataSource { func getCurrentTimelineEntry(for complication: CLKComplication,

The label “Cancel” from modal segue in Apple Watch showing wrong text - “abbrechen”

南笙酒味 提交于 2019-12-04 04:19:30
When my WKInterfaceController poped up by pressing a menuItem (which was settup by " self.addMenuItem in mainScreen"), the title on the poped WKInterfaceController shows " abbrechen " instead of " Cancel ". Anyone know how to fix it to make it showing " Cancel "? Or like where did I probably make a mistake? //MainScreen.swift func setContextItems(directToEnabled: Bool) { self.clearAllMenuItems() self.addMenuItem(with: WKMenuItemIcon.decline, title: "direct", action: #selector(MainScreen.freePressed)) } Clues: It happens only on my Apple Watch device (WatchOS 3.1). When it runs on the simulator

Load image from URL on WatchKit

那年仲夏 提交于 2019-12-04 01:01:43
问题 Is there a more elegant solution to load an external image on the watch than the following ? let image_url:String = "http://placehold.it/350x150" dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)) { let url:NSURL = NSURL(string:image_url)! var data:NSData = NSData(contentsOfURL: url)! var placeholder = UIImage(data: data)! // update ui dispatch_async(dispatch_get_main_queue()) { self.imageView.setImage(placeholder) } } 回答1: NSURL is meant to be used for local files.

Using environmentObject in watchOS

微笑、不失礼 提交于 2019-12-04 00:28:46
I am trying to use environmentObject in a watchOS6 app to bind my data model to my view. I have created a simple, stand-alone Watch app in Xcode 11. I created a new DataModel class import Combine import Foundation import SwiftUI final class DataModel: BindableObject { let didChange = PassthroughSubject<DataModel,Never>() var aString: String = "" { didSet { didChange.send(self) } } } In my ContentView struct I bind this class using @EnvironmentObject - struct ContentView : View { @EnvironmentObject private var dataModel: DataModel var body: some View { Text($dataModel.aString.value) } } Finally

How to trigger notifications using WatchKit

十年热恋 提交于 2019-12-03 22:44:06
In the WatchKit developer guide , there are instructions on how to render custom notifications and it also says: Apps are not required to do anything to support notifications. The system provides a default notification interface that displays the alert message from the notification. However, apps can customize the notification interface and include custom graphics, content, and branding. I can get local notifications to trigger banner alerts on the phone, but they don't happen on the WatchKit app. I have tried debugging using all of the targets: iOS app Watch app Watch Glance Watch custom

NSXMLParserErrorMessage - Could not open data stream

风流意气都作罢 提交于 2019-12-03 22:28:38
I'm stuck in a weird problem. I try to parse an XML-File from a non-HTTPS Webserver for the Apple Watch. Its working great with WatchKit 2.0 and iOS 9.1 in the Xcode Simulator, as soon as try to build it on my Watch, its not working anymore... I also have set the ATS as followed in all Info.plist files: <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict> While debugging I found the following error: [0] (null) "NSXMLParserErrorMessage" : "Could not open data stream" import Foundation import WatchKit class parkingXMLParser : NSObject, NSXMLParserDelegate{

watchOS - Show realtime departure data on complication

醉酒当歌 提交于 2019-12-03 21:23:46
问题 I have an public transport app with realtime departure data for trains. I would like to add a complication that shows the departure time of the next train. Is it possible to show (or refresh) realtime data on a complication? For example, showing "3 min. to station X." The data could change every minute, based on info that comes from the public transport API. How should I accomplish this on watchOS 2 or watchOS 3? I know the ETA app shows travel times in a complication, but I'm not sure how

Images on apple watch

大城市里の小女人 提交于 2019-12-03 21:21:39
问题 I ran into a problem yesterday when my application was rejected. Apparently the images are not being displayed on the actual Apple Watch, however they are being displayed in the simulator. I even tried resetting the simulator and can't replicate the problem that occurred for the apple employee. So I am just wondering what the correct way to add/display images on the apple watch is, such so that they will be displayed properly on the actual hard device? Code: .h @property (strong, nonatomic)

Duplicating target for WatchOS2 with App and Extension on Xcode

£可爱£侵袭症+ 提交于 2019-12-03 17:24:12
I have a project with a WatchOS2 target along with an Extension. I want to duplicate both the WatchOS App target and the extension. However, when I duplicate the WatchOS App target it is still linked to the old extension. Since we no longer have access to build phases for WatchOS App I cannot change it in the Embed App Extension Phase. Inital State WatchAppTarget1 (Embed Extension - WatchAppExtension1) WatchAppExtension1 Final State WatchAppTarget1 (Embed Extension - WatchAppExtension1) WatchAppExtension1 WatchAppTarget-Duplicate (Embed Extension still pointing to - WatchAppExtension1)

How do I force-quit an individual app on an actual Apple Watch (not in the simulators)?

梦想与她 提交于 2019-12-03 15:49:16
When developing an app, it is sometimes useful to force-quit an application without having to re-start the entire device. On my iPhone, I can force-quit the active app by double-clicking the home button and swiping the app to the top. For the actual Apple Watch (not the simulators), force-quitting an app is particularly useful since there are sometimes connection problems between Xcode and the watch app. Also, sometimes I would like to force-quit my Apple Watch app when it is not connected to Xcode. So, how can I force-quit / terminate the active app on the Apple Watch without restarting the