Hi. I'm looking to schedule a number of notifications based on the user's location and have them be triggered UNLocationNotificationTriggers. I want to know whether notifications get delivered so I can limit the number of notifications the user receives in a day. I was hoping I could determine their delivery by either the UNUserNotificationCenterDelegate's method userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse) (which only knows when the user has tapped on the notification or deleted it) or by UNUserNotificationCenter.current().deliveredNotifications() (which should return the notification if it was delivered and is in the Notification Center).
UNUserNotificationCenter.current().deliveredNotifications() is not returning notifications that were delivered via UNLocationNotificationTriggers. I'm assuming this is for some privacy reason? All of the UNLocationNotificationTriggers are configured with notifyOnEntry to be true, notifyOnExit to be false, and repeats to be false. They get delivered appropriately, but I can't determine if/when they get delivered to ensure the user doesn't receive too many notifications. Notifications delivered with a UNTimeIntervalNotificationTrigger are returned as expected.
Is all of this by design or is there another way to determine when a notification scheduled with a UNLocationNotificationTrigger gets delivered? I'm just trying to create the best experience for my users. Thank you.
Post
Replies
Boosts
Views
Activity
I updated the app bundle ID of my app in my associated domains file on my server which can be viewed using the Apple CDN at (https://app-site-association.cdn-apple.com/a/v1/myApp.app) and on my server at (https://myApp.app/.well-known/apple-app-site-association). All I did was update the app Bundle ID of my app in Xcode and likewise in the associated domains file, and now it is no longer working and I'm getting the error Application with identifier ABCDE12345.app.myApp.MyApp is not associated with domain myApp.app. This error is thrown when attempting to use the webcredentials portion of the associated domain file for logging in via Passkey. I've waited for 6 days to let the changes propagate through the CDN but the issue is persisting. Strangely enough, it has worked a few times since I changed it but almost always fails. This intermittent behavior leads me to believe it might be something up with the CDN? The only thing I changed about my appID was the domain, e.g. ABCDE12345.io.oldDomain.MyApp to ABCDE12345.app.myApp.MyApp.
My file is structured as so:
{
"applinks": {
"apps": [],
"details": [
{
"appID": "ABCDE12345.app.myApp.MyApp",
"components": [
...
]
}
]
},
"webcredentials": {
"apps": [
"ABCDE12345.app.myApp.MyApp"
]
}
}
Likewise I updated the entitlements in my app to webcredentials:myApp.app from webcredentials:oldDomain.io and similarly for the appLinks.
I've tried deleting the app, restarting Xcode, clean builds, all that jazz to no avail. Any advice you have for remedying this would be greatly appreciated. This has brought my beta to a halt because no one can log in or sign up. Thank you.
I'm working on an iOS project that is almost entirely SwiftUI, save for the UIViewRepresentable ARView that I'm using. I'm using RealityKit.
When calling MeshResouce.generateText(), fairly often some or all Entities will fail to generate their Mesh with the proper font and will instead render with SF Pro Regular. The font size is not lost, nor any other attributes of the entity. The same data model that generates the entity also provides for a 2D representation of the model, in which the font is never lost. If an entity is generated during makeUIView() of the ARView or during onAppear() of its parent view, the font will never be lost. The font is only lost when the entity is generated in response to user input.
Results are unfazed by using .ttf vs .otf for the font files.
Very often (maybe always?), once one entity fails to render with its provided font, the subsequently generated entities will also fail to render with their font. I have successfully rendered an Entity then rerendered it and it has lost its font.
Possibly related, generating text entities always throws the error CoreText performance note: Client called CTFontCreateWithName() using name "CUSTOM FONT NAME" and got font with PostScript name "CUSTOMFONT-NAME". For best performance, only use PostScript names when calling this API.
This error will not be thrown if the first text entity (and therefore all subsequent entities) fails to render properly. If a single text entity gets generated successfully, then subsequent failing entities are more likely to also throw the error.
Also always get error warning: using linearization / solving fallback when starting AR Session, but it doesn't seem to be related .
Also often (always?) get error 2023-03-27 15:10:30.938146-0700 appName[38594:50629667] [Technique] ARWorldTrackingTechnique <0x15b8d0570>: World tracking performance is being affected by resource constraints [25]
Also often (always?) get error 2023-03-27 15:10:30.060163-0700 appName[38594:50629490] [TraitCollection] Class CKBrowserSwitcherViewController overrides the -traitCollection getter, which is not supported. If you're trying to override traits, you must use the appropriate API.
I don't know if any of those other errors are related but I figured I should include them. This has been happening intermittently for a long time and with a number of different fonts.
I created a very simple version of this in a separate project that will eventually reproduce the error (if you have enough patience). You'll just need to add a non-Apple font to the project. It should render in the provided font sometimes, but when you rerun the project, or if you add the entity enough times, it should fail. It's more likely to fail with the first entity than with subsequent entities, so running the project repeatedly is the most efficient way to reproduce the bug.
import SwiftUI
import RealityKit
class MockRenderQueue: ObservableObject {
@Published var renderActions: [(_ arView: ARView, _ cameraAnchor: AnchorEntity) -> Void] = []
}
struct ContentView : View {
@StateObject var mockRenderQueue = MockRenderQueue()
var body: some View {
ZStack(alignment: .bottom) {
ARViewContainer(renderQueue: mockRenderQueue).edgesIgnoringSafeArea(.all)
Button(action: {
mockRenderQueue.renderActions.append( addTextEntity )
}) {
ZStack {
RoundedRectangle(cornerRadius: 20)
.frame(height: 48)
Text("Add Text Entity")
.bold()
.foregroundColor(.white)
}
}.padding()
}
}
func addTextEntity(to arView: ARView, cameraAnchor: AnchorEntity) {
let fontName = "Font-Name" // Put your font name here
guard let customFont = UIFont(name: fontName, size: 0.1) else {
print("Error: Could not find font")
return
}
// Make text Entity
let textMesh = MeshResource.generateText("hello world", extrusionDepth: 0.001, font: customFont)
let textEntity = ModelEntity(mesh: textMesh, materials: [UnlitMaterial(color: .black)])
// Make an anchor and position it 1m back and centered, facing the user
let anchorEntity = AnchorEntity()
anchorEntity.look(at: [0,0,0], from: [textMesh.bounds.extents.x / -2,0,-1], relativeTo: cameraAnchor)
anchorEntity.transform.rotation *= simd_quatf(angle: .pi, axis: [0,1,0])
// Add TextEntity to anchor
anchorEntity.addChild(textEntity)
// Add the anchor to the camera anchor
cameraAnchor.addChild(anchorEntity)
}
}
struct ARViewContainer: UIViewRepresentable {
@ObservedObject var renderQueue: MockRenderQueue
@State private var cameraAnchor = AnchorEntity(.camera)
func makeUIView(context: Context) -> ARView {
let arView = ARView(frame: .zero)
arView.scene.addAnchor(cameraAnchor)
return arView
}
func updateUIView(_ arView: ARView, context: Context) {
for renderAction in renderQueue.renderActions {
renderAction(arView, cameraAnchor)
}
}
}
I've tried a handful of different implementations, exposing the ARView through a Coordinator, as a singleton, and other things and I just can't break this bug. Does anyone else have this problem? It is a significant detraction from the user experience and I really need to find out how to fix this.
Thank you in advance.
I'm using RealityKit and SwiftUI to place 3DText on iOS but I can't get the text to anchor to a position. I stripped the project down to the bare essentials below and it still doesn't work. The box will anchor and stay in one place as I walk around but the text will follow above my device wherever I move. This is driving me crazy because the box works totally as expected but the text just does not. I have tried so many different iterations of the code below to no avail. I was wondering if anyone else was having this problem or if it was just me, potentially a bug? Is there something else I should try?
import SwiftUI
import RealityKit
struct ContentView : View {
var body: some View {
return ARViewContainer().edgesIgnoringSafeArea(.all)
}
}
struct ARViewContainer: UIViewRepresentable {
func makeUIView(context: Context) -> ARView {
let arView = ARView(frame: .zero)
let anchor = AnchorEntity()
anchor.position = simd_make_float3(0, -0.5, -1)
let textEntity = ModelEntity(mesh: .generateText("Hello there", extrusionDepth: 0.4, font: .boldSystemFont(ofSize: 8), containerFrame: .zero, alignment: .center, lineBreakMode: .byWordWrapping))
let boxEntity = ModelEntity(mesh: .generateBox(size: 0.2))
anchor.addChild(textEntity)
anchor.addChild(boxEntity)
arView.scene.anchors.append(anchor)
return arView
}
func updateUIView(_ uiView: ARView, context: Context) {}
}
I'm trying to send a push notification through a python script that works on my Mac but when ran on my Raspberry Pi the program throws the error
httpcore.ConnectError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1122)
I've tried adding the GeoTrust and the new AAACertificateServices certs to the Pi, but maybe I did something wrong there. Certs perpetually confuse me so I would really appreciate the help. I'm using Token-based authentication so I'm a bit confused as to what certs the errors are referring to in the first place if not the GeoTrust...
Running on a Raspberry Pi 3 Model B with Debian.
Also, running openssl s_client -connect api.sandbox.push.apple.com:443 came back as successfully verified so I'm real confused.
The whole Traceback is:
Traceback (most recent call last):
File "/home/jake/.local/lib/python3.9/site-packages/httpx/_exceptions.py", line 326, in map_exceptions
yield
File "/home/jake/.local/lib/python3.9/site-packages/httpx/_client.py", line 861, in _send_single_request
(status_code, headers, stream, ext) = transport.request(
File "/home/jake/.local/lib/python3.9/site-packages/httpcore/_sync/connection_pool.py", line 218, in request
response = connection.request(
File "/home/jake/.local/lib/python3.9/site-packages/httpcore/_sync/connection.py", line 93, in request
self.socket = self._open_socket(timeout)
File "/home/jake/.local/lib/python3.9/site-packages/httpcore/_sync/connection.py", line 119, in _open_socket
return self.backend.open_tcp_stream(
File "/home/jake/.local/lib/python3.9/site-packages/httpcore/_backends/sync.py", line 143, in open_tcp_stream
return SyncSocketStream(sock=sock)
File "/usr/local/opt/python-3.9.0/lib/python3.9/contextlib.py", line 135, in __exit__
self.gen.throw(type, value, traceback)
File "/home/jake/.local/lib/python3.9/site-packages/httpcore/_exceptions.py", line 12, in map_exceptions
raise to_exc(exc) from None
httpcore.ConnectError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1122)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/jake/Programming/Security/MQTT/NotificationServer.py", line 73, in module
sendAlarmNotification()
File "/home/jake/Programming/Security/MQTT/NotificationServer.py", line 66, in sendAlarmNotification
r = client.post('{}/3/device/{}'.format(server, deviceToken), json=notification, headers=headers)
File "/home/jake/.local/lib/python3.9/site-packages/httpx/_client.py", line 992, in post
return self.request(
File "/home/jake/.local/lib/python3.9/site-packages/httpx/_client.py", line 733, in request
return self.send(
File "/home/jake/.local/lib/python3.9/site-packages/httpx/_client.py", line 767, in send
response = self._send_handling_auth(
File "/home/jake/.local/lib/python3.9/site-packages/httpx/_client.py", line 805, in _send_handling_auth
response = self._send_handling_redirects(
File "/home/jake/.local/lib/python3.9/site-packages/httpx/_client.py", line 837, in _send_handling_redirects
response = self._send_single_request(request, timeout)
File "/home/jake/.local/lib/python3.9/site-packages/httpx/_client.py", line 861, in _send_single_request
(status_code, headers, stream, ext) = transport.request(
File "/usr/local/opt/python-3.9.0/lib/python3.9/contextlib.py", line 135, in __exit__
self.gen.throw(type, value, traceback)
File "/home/jake/.local/lib/python3.9/site-packages/httpx/_exceptions.py", line 343, in map_exceptions
raise mapped_exc(message, **kwargs) from exc type: ignore
httpx.ConnectError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1122)
My code is
import httpx
import time
from jwcrypto import jwt, jwk
devServer = "https://api.sandbox.push.apple.com:443"
prodServer = "https://api.push.apple.com:443"
server = devServer
pemFilePath = "pushCerts/PushNotificationAuthKey_********.p8"
This generates an auth token with the current time, using our pem files
def generateAuthToken():
issueTime = int(time.time())
token = jwt.JWT( header={ "alg" : "ES256", "kid" : "******"}, claims={ "iss": "******", "iat": issueTime} )
with open(pemFilePath, "rb") as pemfile:
key = jwk.JWK.from_pem(pemfile.read())
token.make_signed_token(key)
return token.serialize()
deviceToken = "long device token"
authToken = 'bearer ' + generateAuthToken()
pushType = 'alert'
expiration = '3600'
priority = '10'
topic = 'com.MyName.MyAppName'
headers = {
'authorization' : authToken,
'apns-push-type' : pushType,
'apns-expiration' : expiration,
'apns-priority' : priority,
'apns-topic' : topic
}
I'm very new to Xcode and am trying to use it to write and build C code. I made a project and got everything to work (it'll run Hello World and all that) but once I add a second file to the project (so that I don't have to create a whole new workspace and project and such for every new file I want to work on) the build fails and I get this error:Apple Mach-O Linker (Id) Error Linker command failed with exit code 1 (use -v to see invocation)I don't know what any of that means. Once I get to the error it says all this:duplicate symbol _main in: /Users/JacobSax/Library/Developer/Xcode/DerivedData/C_Programming-ezejclzfpncidecllfwsjhptguwi/Build/Intermediates.noindex/C Programming.build/Debug/C Programming.build/Objects-normal/x86_64/Program 2.o /Users/JacobSax/Library/Developer/Xcode/DerivedData/C_Programming-ezejclzfpncidecllfwsjhptguwi/Build/Intermediates.noindex/C Programming.build/Debug/C Programming.build/Objects-normal/x86_64/Program 3.old: 1 duplicate symbol for architecture x86_64clang: error: linker command failed with exit code 1 (use -v to see invocation)I just want to be able to have multiple files in my project so I don't have to make a new workspace or project whenever I'm writing code. Forgive me for my lack of knowledge. Thanks.