In a collapsible sidebar's toolbar area, I'd like to have icons available when it is open... similar to Xcode and many apps. However, every SwiftUI .toolbar positioning parameter I've tried only affects the main toolbar. Any tips?
Bonus: positioning the sidebar open/close button inside the sidebar toolbar when open and moving it to the main toolbar's leftmost side when not.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Upon trying to upload a new build to App Connect, which worked fine four weeks ago, validate gives an error that:
The product archive package's signature is invalid. Ensure that it is signed with your "3rd Party Mac Developer Installer" certificate.
Uploading gives the same error:
ERROR ITMS-90237: "The product archive package's signature is invalid. Ensure that it is signed with your "3rd Party Mac Developer Installer" certificate."
This is despite updating in my developer profile and downloading the new "3rd Party Mac Developer Installer" certificate, which shows up as valid in my keychain. So confused...
Topic:
App Store Distribution & Marketing
SubTopic:
App Store Connect
Tags:
App Store Connect
Signing Certificates
That happened on launch this morning. Why? Never seen that before.
Goal
With an MTKView, replicate the gravity of the AVCaptureVideoPreviewLayer or Apple's Camera app. Video device orientation does not change. The camera feed's edges do not budge a pixel, never revealing the screen background. Other on-screen VCs rotate normally.
Observed
Applying Tech QA 1890's transform during viewWillTransition, the MTKView does counter-rotate... BUT that rotation is still uncomfortably visible. The edges of the view come unpinned during the animation, masking some camera pixels and showing a white background set for the VC holding the MTKView.
Question
How can I make those edges stick to screen bounds like a scared clam?
I assume my error is in constraints, but I'm open to being wrong in other ways. :)
View Hierarchy
A tiny camera filter app has an overlay of camera controls (VC #1) atop an MTKView (in VC #2) pinned to the screen's edges.
UINavigationController
│
└─ CameraScreenVC
│
├── CameraControlsVC <- Please rotate subviews
│
└── MetalCameraFeedVC
└── MTKView <- Please no rotation edges
Code
Buildable demo repo
Relevant snippets below.
MetalCameraVC.swift
final class MetalCameraVC: UIViewController {
let mtkView = MTKView() // This VC's only view
/// Called in viewDidAppear
func setupMetal(){
metalDevice = MTLCreateSystemDefaultDevice()
mtkView.device = metalDevice
mtkView.isPaused = true
mtkView.enableSetNeedsDisplay = false
metalCommandQueue = metalDevice.makeCommandQueue()
mtkView.delegate = self
mtkView.framebufferOnly = false
ciContext = CIContext(
mtlDevice: metalDevice,
options: [.workingColorSpace: CGColorSpace(name: CGColorSpace.sRGB)!])
}
...
func mtkView(_ view: MTKView, drawableSizeWillChange size: CGSize) {
// blank
}
func draw(in mtkview: MTKView) {
image = image.transformed(by: scaleToScreenBounds)
image = image.cropped(to: mtkview.drawableSize.zeroOriginRect())
guard let buffer = metalCommandQueue.makeCommandBuffer(),
let currentDrawable = mtkview.currentDrawable
else { return }
ciContext.render(image,
to: currentDrawable.texture,
commandBuffer: buffer,
bounds: mtkview.drawableSize.zeroOriginRect(),
colorSpace: CGColorSpaceCreateDeviceRGB())
buffer.present(currentDrawable)
buffer.commit()
}
}
extension MetalCameraVC {
override func viewDidLoad() {
super.viewDidLoad()
view.addSubview(mtkView)
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
mtkView.frame = view.frame
if let orientation = AVCaptureVideoOrientation.fromCurrentDeviceOrientation() {
lastOrientation = orientation
}
}
}
+Rotation
/// Apple Technical QA 1890 Prevent View From Rotating
extension MetalCameraVC {
override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
mtkView.center = CGPoint(x: view.bounds.midX, y: view.bounds.midY)
}
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransition(to: size, with: coordinator)
coordinator.animate { [self] context in
let delta = coordinator.targetTransform
let deltaAngle = atan2(delta.b, delta.a)
var currentAngle = mtkView.layer.value(forKeyPath: "transform.rotation.z") as? CGFloat ?? 0
currentAngle += -1 * deltaAngle + 0.1
mtkView.layer.setValue(currentAngle, forKeyPath: "transform.rotation.z")
} completion: { [self] context in
var rounded = mtkView.transform
rounded.a = round(rounded.a)
rounded.b = round(rounded.b)
rounded.c = round(rounded.c)
rounded.d = round(rounded.d)
mtkView.transform = rounded
}
}
}
While mutable push notifications process properly in a cousin Catalyst/iOS app, my macOS app does not execute methods in its Notification Service extension to mutate notification content before presentation (when app is active, in background, or terminated).
Console logs (below) show the Mac extension is found and launched, but then killed for "sluggish startup". It is the vanilla new file stub with zero dependencies. I'm doubtful this matters, but I am running Monterey RC1/Xcode 13 RC on an M1.
What am I configuring improperly?
Objective
Push a remote notification ~once a month to download a file, locally process user data, and then silence or display a modified alert accordingly.
I've Tried
Per macOS Notification Service Extension not being used
Ensured sandboxed
Enabled "Incoming Connection (Server)" (no difference)
Wipe DerivedData
Run on naive second Mac
Per Notification Service Extension Not working
Rebooting the Mac
Ensuring the deployment target of the app and extension are identical
Received Notification
From application(_ app: NSApplication, didReceiveRemoteNotification userInfo: [String : Any])
["customThing": value, "aps": {
alert = "Push Mutable";
"mutable-content" = 1;
sound = default;
}]
Signing/Capabilities
App Debug/Release
Sanboxed w/ outgoing connections
Hardened runtime
iCloud
Push (certificates)
Automatic signing w/ cert
Notifications Extension
Sandboxed
Hardened runtime
Automatic signing
Extension
class NotificationService: UNNotificationServiceExtension {
var contentHandler: ((UNNotificationContent) -> Void)?
var bestAttemptContent: UNMutableNotificationContent?
override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
self.contentHandler = contentHandler
bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
if let bestAttemptContent = bestAttemptContent {
bestAttemptContent.title = "[modified]"
bestAttemptContent.body = "Changed"
contentHandler(bestAttemptContent)
}
}
override func serviceExtensionTimeWillExpire() {
if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {
contentHandler(bestAttemptContent)
}
}
}
Console
Perhaps relevant?
usernoted <IDENTIFIER> Extension will be killed due to sluggish startup error serviceExt com.apple.unc usernoted
LogFromBuildToNotificationPush.txt
I guess this is more of a public question for Apple: can/will tide data be packaged into WeatherKit? (FB10383248)