Post not yet marked as solved
I’ve run into a roadblock with Apple Pay on the WatchOS 7.At first I had Apple Cash card and a bank card on Apple Pay for watch wallet. When attempting to pay at working terminals that accept Apple Pay it would come back declined in on the watch say “double click to pay”, which would promptly disappear when the card reader reported declined.
Has anyone else and counted this issue since updating to 7?
Troubleshooting Performed
Verified I’m using the same bank card as was previously on WatchOS 6 on Apple Pay without issue.
First i attempted to remove Apple Cash and test with just bank card, similar results as reported above.
Next I attempted to remove all cards and re-add bank card, same result.
Before the inquiry is made, I did is this on multiple terminals that previously worked with my watch prior to watchOS 6 and still have Apple Pay.
Post not yet marked as solved
Is there a way to build a complication with a PogressView / Gauge that updates it's progress based on a start and end dates like CLKTimeIntervalGaugeProvider ?
Post not yet marked as solved
Hello all. I am wondering if anyone has had issues running their WatchOS application on a real device from Xcode/knows a way around this. It is painful whenever I try to run my watchOS application on a real device. Most of the time it doesn't even run. The times it does successfully install and run on my device, it usually takes 5-15 minutes to finish.
I didn't have these issues a couple of years ago on earlier versions of Xcode and WatchOS. This issue has only been occurring recently.
Im using a MacBook Pro 2018, an Apple Watch Series 5, and Xcode 12 Beta 2 (I had the same issues on Xcode 11 too).
Any help would be greatly appreciated. Thank you.
Post not yet marked as solved
I'm trying to search for nearby locations on my WatchKit app, but MKLocalSearch is unsupported on WatchOS. Is there an alternative way to get nearby locations on a WatchKit app?
Post not yet marked as solved
Hi!
I have a Apple Watch app that is bundled with my iOS app. However, when I install the app using TestFlight it crashes on launch.
The app runs fine when launching directly from Xcode. Any tips on how to investigate the cause of this problem?
I have exported the diagnosis log for the app, but that doesn't say me much:
Exception Type: EXCCRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXCCORPSE_NOTIFY
Termination Reason: Namespace WATCHKIT, Code 0x1
Triggered by Thread: 0 Thread 0 Crashed:
0	 libsystem_kernel.dylib				 0x1e3fe060 0x1e3d5000 + 168032
1	 libsystem_kernel.dylib				 0x1e40297c 0x1e3d5000 + 186748
2	 libsystem_kernel.dylib				 0x1e402918 0x1e3d5000 + 186648
3	 WatchKit											 0x33b49df4 0x33a8a000 + 785908
4	 WatchKit											 0x33b4af38 0x33a8a000 + 790328
5	 libdispatch.dylib						 0x1e22c658 0x1e229000 + 13912
6	 libdispatch.dylib						 0x1e22dcbc 0x1e229000 + 19644
7	 WatchKit											 0x33aa75f0 0x33a8a000 + 120304
8	 WatchKit											 0x33aa7384 0x33a8a000 + 119684
9	 UIKitCore										 0x3f226e78 0x3e848000 + 10350200
10	UIKitCore										 0x3f22cc40 0x3e848000 + 10374208
11	UIKitCore										 0x3ea3b74c 0x3e848000 + 2045772
12	UIKitCore										 0x3f228960 0x3e848000 + 10357088
13	UIKitCore										 0x3f228d9c 0x3e848000 + 10358172
14	UIKitCore										 0x3f22ea68 0x3e848000 + 10381928
15	WatchKit											 0x33aa6af8 0x33a8a000 + 117496
16	libdyld.dylib								 0x1e269de8 0x1e269000 + 3560
Thread 1:
0	 libsystem_pthread.dylib			 0x1e4835b4 0x1e479000 + 42420
Thread 2:
0	 libsystem_pthread.dylib			 0x1e4835b4 0x1e479000 + 42420
Thread 3:
0	 libsystem_pthread.dylib			 0x1e4835b4 0x1e479000 + 42420
Thread 4:
0	 libsystem_pthread.dylib			 0x1e4835b4 0x1e479000 + 42420
Thread 5 name:	com.apple.uikit.eventfetch-thread
Thread 5:
0	 libsystem_kernel.dylib				 0x1e3db8a4 0x1e3d5000 + 26788
1	 libsystem_kernel.dylib				 0x1e3dad00 0x1e3d5000 + 23808
2	 CoreFoundation								 0x1e7f2a0c 0x1e75d000 + 612876
3	 CoreFoundation								 0x1e7ed414 0x1e75d000 + 590868
4	 CoreFoundation								 0x1e7ecb70 0x1e75d000 + 588656
5	 Foundation										 0x1f313fc0 0x1f30c000 + 32704
6	 Foundation										 0x1f313ea0 0x1f30c000 + 32416
7	 UIKitCore										 0x3f2c2074 0x3e848000 + 10985588
8	 Foundation										 0x1f4738a0 0x1f30c000 + 1472672
9	 libsystem_pthread.dylib			 0x1e47af04 0x1e479000 + 7940
10	libsystem_pthread.dylib			 0x1e4835c8 0x1e479000 + 42440
Thread 0 crashed with ARM Thread State (64-bit):
		x0: 0x0000000000000016	 x1: 0x0000000000000001	 x2: 0x0000000000000000	 x3: 0x0000000000000000
		x4: 0x000000001766dc29	 x5: 0x0000000000000002	 x6: 0x0000000000000000	 x7: 0x0000000000000000
		x8: 0x0000000000000020	 x9: 0x0000000089b10070	x10: 0x000000004bee7c00	x11: 0x0000000000000000
	 x12: 0x0000000000ff0007	x13: 0x000000001a321000	x14: 0x0000000000033fe8	x15: 0x0000000000000000
	 x16: 0x0000000000000209	x17: 0x0000000000000001	x18: 0x0000000000000000	x19: 0x0000000000000002
	 x20: 0x000000001766dc29	x21: 0x0000000000000000	x22: 0x0000000000000000	x23: 0x0000000000000001
	 x24: 0x0000000000000016	x25: 0x000000004d237ef0	x26: 0x0000000017670310	x27: 0x000000000000000c
	 x28: 0x000000004ef60000	 fp: 0x0000000004abf320	 lr: 0x000000001e40297c
		sp: 0x0000000004abf2e0	 pc: 0x000000001e3fe060 cpsr: 0x40000000
	 esr: 0x56000080	Address size fault
Post not yet marked as solved
I'm using Xcode 12 beta 3. When running my Apple Watch's target on WatchOS 7, I get this error:
Warning: Error creating LLDB target at path '/Users/evan/Library/Developer/Xcode/DerivedData/audigo-cneguthkmmoulfgcprsazbryrlrl/Build/Products/Debug-watchsimulator/AudigoWatchApplication.app'- using an empty LLDB target which can cause slow memory reads from remote devices.
I know this error use to be when running 32 bit frameworks on 64 bit devices, but I'm not doing that. Is this a bug? Or is there a setting I don't know of that needs to be updated?
Post not yet marked as solved
I'm building a standalone WatchOS app. I have tried implementing the .onDelete modifier to easily delete items in a list, and I get no warnings or errors in XCode. But swiping, both in the simulator and Live Preview, does not do anything.
This is tested both in XCode 11.6 with WatchOS 6.2, and XCode 12.0 beta 2 with WatchOS 7.
Am I missing something here?
Minimal example:
struct ContentView: View {
@State var names = ["Alpha", "Bravo", "Charlie", "Delta"]
var body: some View {
ScrollView {
ForEach(names, id: \.self) { name in
Button(action: {}) {
Text(name)
}
}.onDelete(perform: deleteItems)
}
}
private func deleteItems(at offsets: IndexSet) {
names.remove(atOffsets: offsets)
}
}
Post not yet marked as solved
I have a Settings.bundle for my app Roughly, which tells the approximate time in words (e.g. it's about quarter to six) in a complication. It supports a number of languages, but I allow people to use a different language to their own, to help them learn how to tell the time in another language.
The preference switch works fine in the Watch app on the iPhone, but if a user downloads the app direct from the App Store to their watch, there is no way for them to access those preferences. The preferences do not appear in the Watch app without the iOS app present on the iPhone.
Does anyone have a good solution to this? Do I have to offer a preferences switch in the app itself?
Post not yet marked as solved
I’m trying to get background URL sessions working to keep my complications up to date. The docs and session videos from this year state that I should get ~4 background network updates per hour if I have my complication active, but it is taking up to 1.5 hours to get just one background URL session to return on watchOS 7 beta 4.
I’m using the sample code from this year’s WWDC session on keeping complications up to date.
I am scheduling the URL session to begin after 15 minutes. I have a complication active on the watch. The watch has plenty of battery and is connected to wifi. I’m completing all URL background refresh tasks within 15 secs.
Important Note*
I do get a URLSessionRefreshBackgroundTask around the time of the earliest begin date, but it just calls willBeginDelayedRequest then urlSessionDidFinishEvents - the download itself doesn’t happen for another hour. (I call setTaskCompleted once urlSessionDidFinishEvents is called, as the session video recommends.)
Is anyone else experiencing long delays between when a scheduled download is supposed to begin and when the app is actually woken up?
I've filed this as FB8386427 in case any engineers happen to see this.
That may seem like an odd question, but hear me out...
I have a couple of apps that I've written: A Watch app, and an iOS app. They are both basically "faces" of the same thing.
The Watch app has just been submitted as a standalone app, for offer in the new Watch App Store. The iOS app has already been in the iOS App Store.
It would be nice to have the Watch app embedded in the iOS app, so that people getting the iOS app would also get the Watch app. They don't have any interactions with each other. It would just be a "2fer" deal.
What I would like, is if people that had the Watch app, were to download the iOS app, the embedded app would not interfere with the one they got from the App Store, or would replace it.
It seems that I can't set this up in Xcode. It has to be one or the other. This can be done by giving them different App IDs, but that means that the user could get two copies of the same app on the Watch, with one not aging well.
Is there a way to get a Watch app to be both embedded AND standalone?
Post not yet marked as solved
In WatchOS 6 a presented .sheet could be dismissed by swiping down or tapping on the navigationBarTitle. In the WatchOS 7 beta, presented sheets are no longer dismissible by either method...forcing the addition of a button to dismiss.
It appears as if .sheet is now acting as .fullScreenCover within WatchOS 7.
Anyone else running into this? Wondering if this is now expected behavior on WatchOS or if it's a bug...
I'm trying out the new NavigationView in watchOS 7 and having some issues with the navigation bar not showing up in child views.
Example
import SwiftUI
struct ContentView: View {
var body: some View {
NavigationView {
NavigationLink(
destination: DestinationView(),
label: {
Text("Destination")
})
.navigationTitle("Root")
}
}
}
struct DestinationView: View {
var body: some View {
NavigationView {
Text("I'm here!")
.navigationTitle("Destination")
}
}
}
Test setup
macOS 11.0 Beta 5
watchOS 7.0 Beta 6
Xcode 12.0 Beta 6
When running the app in the simulator or on the watch, the root view correctly displays the navigation bar, while the destination view does not.
Confusingly, the Xcode live preview does the opposite: The root view is missing the navigation bar, but the destination view is showing both the title and back button correctly.
The only mode in which the navigation bar is visible in both views is if I from Xcode select Preview on Device.
I'm new to SwiftUI and though I'm leaning toward this being a bug with the beta, I thought I'd check here to make sure I'm not just doing it wrong.
Post not yet marked as solved
Hello!
I have a WatchOS Application on TestFlight that is crashing on startup on Apple Watch Series 3 devices (32-bit). It works flawlessly on Simulators (Xcode 11.7) and Apple Watch Series 4. I am using Alamofire 5.2.2 with Swift Package Manager. Latest Xcode (version 11.7). The device is Apple Watch Series 3 devices (32-bit) running latest final watchOS (version 6.2.8).
I am calling a REST service that returns a JSON error file (response) and HTTP status code 401 (Unauthorized) if no gateway access token is given.
As I said this works in simulator and Apple Watch Series 4 device. I suspect of Bitcode, as in the past versions I had an iOS companion app and disabled bitcode generation, but now we only have the watch app and I cannot disable Bitcode generation.
What happened instead?
The crash is somewhat like this:
Hardware Model:			Watch3,4
Process:						 Watch App Extension [616]
Version:						 132 (1.0)
AppVariant:					1:Watch3,4:6
Beta:								YES
Code Type:					 ARM (Native)
Role:								Foreground
Parent Process:			launchd [1]
Date/Time:					 2020-09-02 15:52:50.8659 -0300
Launch Time:				 2020-09-02 15:52:48.0000 -0300
OS Version:					Watch OS 6.2.8 (17U63)
Release Type:				User
Baseband Version:		n/a
Report Version:			104
Exception Type:	EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x00000060
VM Region Info: 0x60 is not in any region.	Bytes before following region: 2310048
			REGION TYPE							START - END		 [ VSIZE] PRT/MAX SHRMOD	REGION DETAIL
			UNUSED SPACE AT START-->	
			__TEXT								 00234000-0038c000 [ 1376K] r-x/r-x SM=COW	...App Extension
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [616]
Triggered by Thread:	0
Thread 0 name:	Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0	 libswiftCore.dylib						 0x6f7f4060 static _SetStorage.allocate+ 864352 (scale:age:seed:) + 16
1	 libswiftCore.dylib						 0x6f7f007e static _SetStorage.allocate+ 847998 (capacity:) + 126
2	 Watch App Extension 0x002fcca4 specialized protocol witness for Collection.endIndex.getter in conformance [A] + 822436 (_$s30Watch_App_Extension12SimulaCambioMp:0)
3	 Watch App Extension 0x002ebcfe static ResponseSerializer.defaultEmptyRequestMethods.getter + 752894 (contaFormatada.modify:102)
4	 Watch App Extension 0x002801e2 AlamofireLoginService.loginSmartwatch(completion:) + 311778 (AlamofireLoginService.swift:49)
5	 Watch App Extension 0x0027b568 specialized InterfaceController.doLogin(:semProgresso:) + 292200 (InterfaceController.swift:0)
6	 Watch App Extension 0x00275ec6 InterfaceController.awake(withContext:) + 270022 (InterfaceController.swift:246)
7&#9; Watch App Extension 0x00276888 @objc InterfaceController.awake(withContext:) + 272520 (<compiler-generated>:0
8&#9; WatchKit&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; 0x5f1959c2 _WKInterfaceControllerCreateClass + 444
9&#9; WatchKit&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; 0x5f1ceef4 __153-[SPRemoteInterface createViewController:className:properties:contextID:info:gestureDescriptions:clientIdentifier:interfaceControllerCreationCompletion:]_block_invoke_3 + 348
10&#9;WatchKit&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; 0x5f1cebbe __153-[SPRemoteInterface createViewController:className:properties:contextID:info:gestureDescriptions:clientIdentifier:interfaceControllerCreationCompletion:]_block_invoke_2 + 1070
11&#9;WatchKit&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; 0x5f194130 spUtils_dispatchAsyncToMainThread + 22
12&#9;WatchKit&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; 0x5f1ce75c __153-[SPRemoteInterface createViewController:className:properties:contextID:info:gestureDescriptions:clientIdentifier:interfaceControllerCreationCompletion:]_block_invoke + 156
13&#9;WatchKit&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; 0x5f1956c4 -[SPRemoteInterface performAfterApplicationDidFinishLaunching:] + 40
14&#9;WatchKit&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; 0x5f195410 -[SPRemoteInterface createViewController:className:properties:contextID:info:gestureDescriptions:clientIdentifier:interfaceControllerCreationCompletion:] + 282
15&#9;WatchKit&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; 0x5f23564a __178-[SPExtensionConnection interfaceViewController:createCompanionControllerClass:properties:initializationContextID:info:gestureDescriptions:interfaceControllerCreationCompletion:]_block_invoke + 294
16&#9;WatchKit&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; 0x5f192ba2 -[SPExtensionConnection performOnSendQueue:syncIfUnsuspended:] + 464
17&#9;WatchKit&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; 0x5f195298 -[SPExtensionConnection interfaceViewController:createCompanionControllerClass:properties:initializationContextID:info:gestureDescriptions:interfaceControllerCreationCompletion:] + 284
18&#9;WatchKit&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; 0x5f1950f4 -[SPApplicationDelegate viewController:createWKInterfaceControllerClass:properties:contextID:creationCompletion:] + 1588
19&#9;WatchKit&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; 0x5f183740 -[SPInterfaceViewController loadView] + 2004
20&#9;UIKitCore&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; 0x678d7aca -[UIViewController loadViewIfRequired] + 160
21&#9;UIKitCore&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9;&#9; 0x678d80f0 -[UIViewController view] + 24
...
Thread 0 crashed with ARM Thread State (32-bit):
&#9;&#9;r0: 0x00000001&#9;&#9;r1: 0x00000000&#9;&#9;&#9;r2: 0x00000001&#9;&#9;&#9;r3: 0x00000000
&#9;&#9;r4: 0x00000001&#9;&#9;r5: 0x00000001&#9;&#9;&#9;r6: 0x000000e4&#9;&#9;&#9;r7: 0x27bcd708
&#9;&#9;r8: 0x00000000&#9;&#9;r9: 0x00000000&#9;&#9; r10: 0x00000000&#9;&#9; r11: 0x16db3fd0
&#9;&#9;ip: 0xfff00000&#9;&#9;sp: 0x27bcd670&#9;&#9;&#9;lr: 0x6f7f007f&#9;&#9;&#9;pc: 0x6f7f4060
&#9;cpsr: 0x60000030
Binary Images:
0x234000 - 0x3d3fff Watch App Extension armv7k&#9;<53780c55b55534578139202ab803cb6a> /var/containers/Bundle/Application/8D10BAB7-2EDF-4C98-8558-915BEBC0F499/Watch App.app/PlugIns/Watch App Extension.appex/Watch App Extension
NOTE
Unfortunately this is a big project for a bank. I do not have yet a demo project because the error only occurs via TestFlight installing on Apple Watch Series 3 (32-bits). Already opened an issue on Alamofire GitHub but they said maybe it is an Apple TestFlight generation (bitcode?) error. < https://github.com/Alamofire/Alamofire/issues/3295 >
Post not yet marked as solved
TLDR: I want to use the watch GPS for location even when the phone is in range.
Previously this was not allowed, but I have recently seen multiple apps that allow you to force their watch extension to use the on-watch GPS for corelocation even when the phone is in range.
I understand there is a battery life impact, but this is critical for my application and I have been unable to find how to do it. Help please!
Post not yet marked as solved
I have a apple watch series 1 on watch os 6, and an iPhone 11 on ios 13
I was planning to upgrade my iPhone ios 14 but was fearing if my apple watch wont pair as it is now discontinued for support and will stay on watch os 6
please help
Post not yet marked as solved
Hi. I am pairing my Apple Watch Series 5 to my iPhone running ios 14. The pairing is successful but unable to proceed with the set up because an update is needed to be downloaded first. I updated the os for watch but I keep on getting “Unable to Check for Update - Checking for a software update failed because you are not connected to the internet”. I am definitely connected to the internet.
Watch was reset to factory defaults and I am now pairing it as a new device but it fails due to the issue mentioned above.
Post not yet marked as solved
I have downloaded Xcode 12, the newest version, from App Store. On my exising iOS project, I added a WatchKit app with deployment target of watchOS 7.0. However, when I try to run the watch app on simulator, it tries to install then gives me this error in an alert:
This app could not be installed at this time. Could not install at this time. WatchKit 1.0 apps are no longer installable on this watchOS version. I don't know what's wrong with the target that causes it to give this error. Like said before, the deployment target for the app is watchOS 7 and the app uses SwiftUI. I also can't get a preview on SwiftUI because it gives me the same error saying cannot install.
I have another iOS project with a WatchKit app that is running just fine.
Do you have this problem also or know how to resolve it? Any help is appreciated.
For iOS 14 and watchOS 7.0, I completely recoded and modernized my app using Swift (was Objective C). I am almost done and am most proud of the job, but I have this issue that I need to fix on the Apple Watch app. I am not able to transfer data to the Apple Watch from the iPhone and get the following console messages. (The [***:xxxxxx] are my modification of the console messages.). I am guessing that the first 2 messages are the thing I need to fix and I need to fix this issue before I submit the app.
2020-09-24 08:29:02.873423-0400 WatchApp Extension[***:xxxxxx] [default] lookupMainFuncAddressInMachHeader:71: Invalid Swift entry point data
2020-09-24 08:29:02.874413-0400 WatchApp Extension[***:xxxxxx] [default] lookupMainFuncAddressInMachHeader:77: Swift entry point addres could not be determined.
2020-09-24 08:29:04.001368-0400 WatchApp Extension[***:xxxxxx] [WC] denying activation due to missing delegate
ExtensionDelegate: your iphone is Reachable
ExtensionDelegate: Session activated
2020-09-24 08:29:10.884500-0400 WatchApp Extension[***:xxxxxx] [WC] already in progress or activated
2020-09-24 08:29:15.046379-0400 WatchApp Extension[***:xxxxxx] [WC] WCSession is missing its delegate
2020-09-24 08:29:15.047176-0400 WatchApp Extension[***:xxxxxx] [WC] WCSession is missing its delegate
2020-09-24 08:29:15.047860-0400 WatchApp Extension[***:xxxxxx] [WC] WCSession is missing its delegate
2020-09-24 08:29:15.782075-0400 WatchApp Extension[***:xxxxxx] [WC] already in progress or activated
2020-09-24 08:29:24.390293-0400 WatchApp Extension[***:xxxxxx] [WC] already in progress or activated
2020-09-24 08:31:57.059417-0400 WatchApp Extension[***:xxxxxx] [WC] already in progress or activated
2020-09-24 08:32:00.055282-0400 WatchApp Extension[***:xxxxxx] [WC] already in progress or activated
InterfaceController: your iphone is Reachable
2020-09-24 08:32:00.058230-0400 WatchApp Extension[***:xxxxxx] [WC] already in progress or activated
2020-09-24 08:32:08.427192-0400 WatchApp Extension[***:xxxxxx] [WC] already in progress or activated
2020-09-24 08:32:13.374677-0400 WatchApp Extension[***:xxxxxx] [WC] WCSession is missing its delegate
2020-09-24 08:32:13.375717-0400 WatchApp Extension[***:xxxxxx]] [WC] WCSession is missing its delegate
2020-09-24 08:32:13.376426-0400 WatchApp Extension[***:xxxxxx] [WC] WCSession is missing its delegate
2020-09-24 08:32:51.861915-0400 WatchApp Extension[***:xxxxxx] [WC] already in progress or activated
Hi everyone,
Running Xcode 12, I'm developing a standalone WatchOS App using Spritekit.
I'm using a simple Palette-swap shader using a SKShader with several SKAttributes.
The shader seems to work fine, however I get the following message in the console: [Metal Compiler Warning] Warning: Compilation succeeded with:
program_source:3:19: warning: unused variable 's'
constexpr sampler s(coord::normalized,
I have no idea what this means, there is no variable 's' in my code so I guess this is an issue because GLGS shader code gets compiled to Metal in the background and it goes wrong there? How do I verify this? It seems there is a memory leak associated with this error so I'm prone to solve it. Any help would be appreciated, even if it's just pointing me in a direction. (Like, should I write a new palette shader in Metal?) Thanks in advance!
The function that adds the SKShader (an extension to SKSpriteNode):
func addMultiColorShader(strokeColor: UIColor, colors:[UIColor]) {
let useColors:[UIColor] = shaderColors(colors)
var attributes:[SKAttribute] = [SKAttribute(name: "a_size", type: .vectorFloat2),
SKAttribute(name: "a_scale", type: .vectorFloat2),
SKAttribute(name: "a_alpha", type: .float)]
let colorNames:[String] = ["a_color0","a_color1","a_color2","a_color3"]
for i in 0..<colorNames.count {
attributes += [SKAttribute(name: colorNames[i], type: .vectorFloat4)]
}
let shader = SKShader(fromFile: "SKHMultiColorize", attributes: attributes)
setShaderAttributes(size: self.size, scale: CGSize(width: self.xScale, height: self.yScale), alpha: self.alpha)
setShaderColors(strokeColor: strokeColor, color1: useColors[0], color2: useColors[1], color3: useColors[2])
self.shader = shader
}
The actual shader code (OpenGL GS):
vec2 nearestNeighbor(vec2 loc, vec2 size) {
vec2 onePixel = vec2(1.0, 1.0) / size;
vec2 coordinate = floor(loc * size) / size; // round
return coordinate + (onePixel * 0.5);
}
void main()
{
vec4 colors[4];
colors[0] = a_color0;
colors[1] = a_color1;
colors[2] = a_color2;
colors[3] = a_color3;
vec4 currentColor = texture2D(u_texture, nearestNeighbor(v_tex_coord, a_size));
int colorIndex = int((currentColor.r * 5.1));
vec4 refColor = colors[colorIndex];
gl_FragColor = refColor * currentColor.a;
}
Post not yet marked as solved
As noted on the comparison page for Apple Watch - Series 6 - https://www.apple.com/watch/compare/, the U1 chip (Ultra Wideband) is a feature of the Apple Watch - Series 6. The WWDC 2020 session, Meet Nearby Interaction - https://developer.apple.com/videos/play/wwdc2020/10668/, does imply that this functionality exists on devices with a U1 chip, though the NearbyInteraction framework appears unavailable in watchOS.
Can anyone confirm whether NearbyInteraction is available for watchOS?