I'm debugging some Regex Builder code in my Playground. I run
the following piece code:
let timeMatchWithout = possibleTime.firstMatch(of: timeWithoutSec)
and I get this error message:
Regex.Match optional storedCapture contains no some
What could this possibly mean? contains no some???
Here is a more complete snippet, if this helps:
let hourRef = Reference<Substring>()
let minuteRef = Reference<Substring>()
let hourReg = Regex {
ChoiceOf {
Capture(as: hourRef) {
One(.digit)
One(.digit)
}
Capture(as: hourRef) {
One(.digit)
}
}
}
let minuteReg = Regex {
ChoiceOf {
Capture(as: minuteRef) {
One(.digit)
One(.digit)
}
Capture(as: minuteRef) {
One(.digit)
}
}
}
let ampmRef = Reference<Substring>()
let ampmReg = Regex {
Capture(as: ampmRef) {
ZeroOrMore {
ChoiceOf {
One("am")
One("pm")
One("a.m.")
One("p.m.")
}
}
} /* transform: {
$0.lowercase
} */
}.ignoresCase()
let timeWithoutSec = Regex {
hourReg
One(":")
minuteReg
ZeroOrMore(.whitespace)
ampmReg
}.ignoresCase()
let possibleTime = "10:20 AM"
let timeMatchWithout = possibleTime.firstMatch(of: timeWithoutSec)
The last line produces the error message.
Thanks for the help.
Note the removed transform: on the ampmReg definition. If that is included the compiler times out as noted in my previous post, yesterday.
I get a crash every time I try to swap this texture for a drawable queue.
I have a DrawableQueue leftQueue created on the main thread, and I invoke this block on the main thread. Scene.usda contains a reference to a model cinema. It crashes on the line with the replace().
if let shaderMaterial = try? await ShaderGraphMaterial(named: "/Root/cinema/_materials/Screen", from: "Scene.usda", in: theaterBundle) {
if let imageParam = shaderMaterial.getParameter(name: "image"), case let .textureResource(imageTexture) = imageParam {
imageTexture.replace(withDrawables: leftQueue)
}
}
One weird thing, the imageParam has an invalid value when it crashes.
imageParam RealityFoundation.MaterialParameters.Value <invalid> (0x0)
Here is the stack trace is:
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x9)
frame #0: 0x0000000191569734 libobjc.A.dylib`objc_release + 8
frame #1: 0x00000001cb9e5134 CoreRE`re::SharedPtr<re::internal::AssetReference>::reset(re::internal::AssetReference*) + 64
frame #2: 0x00000001cba77cf0 CoreRE`re::AssetHandle::operator=(re::AssetHandle const&) + 36
frame #3: 0x00000001ccc84d14 CoreRE`RETextureAssetReplaceDrawableQueue + 228
frame #4: 0x00000001acf9bbcc RealityFoundation`RealityKit.TextureResource.replace(withDrawables: RealityKit.TextureResource.DrawableQueue) -> () + 164
* frame #5: 0x00000001006d361c Screenlit`TheaterView.setupMaterial(self=Screenlit.TheaterView @ 0x000000011e2b7a30) at TheaterView.swift:245:74
frame #6: 0x00000001006e0848 Screenlit`closure #1 in closure #1 in closure #1 in closure #1 in TheaterView.body.getter(self=Screenlit.TheaterView @ 0x000000011e2b7a30) at TheaterView.swift:487
frame #7: 0x00000001006f1658 Screenlit`partial apply for closure #1 in closure #1 in closure #1 in closure #1 in TheaterView.body.getter at <compiler-generated>:0
frame #8: 0x00000001004fb7d8 Screenlit`thunk for @escaping @callee_guaranteed @Sendable @async () -> (@out τ_0_0) at <compiler-generated>:0
frame #9: 0x0000000100500bd4 Screenlit`partial apply for thunk for @escaping @callee_guaranteed @Sendable @async () -> (@out τ_0_0) at <compiler-generated>:0
I posted earlier about my problems seing my own build in the Testflight app, despite it being in "Testing" status for the internal tester group. I added more users and they are all receiving invitations and testing the build normally.
I am the only one who doesn't see the build in my Testflight app in my iPhone. I tried sending myself a new invitation, I removed and re-added myself, nothing works.
With other apps, no problems at all. I see my own builds and am able to install and run them as a member of the internal test group.
The same app built with XCode installs and works normally on my phone. What is the problem with Testflight distribution ?
Hi, I have been trying to add Settings Bundle to my app that utilizes DNS Proxy and Content Filter, however, I noticed some weird behavior. I worked with Settings Bundle before, but the initial implementation didn't work for some reason.
So, I simplified it to just one toggle switch and tried again.
Initially, I had an observer adding in the init of my SettingsBundleService class and I was using a shared instance in DNS Proxy target, as a result, SettingsBundleService was observing changes but would always return false. But when I tried to use a shared instance from the main target, it worked just fine.
public final class SettingsBundleService {
static let shared = SettingsBundleService()
private (set) var test: Bool = false
init() {
registerSettingsBundle()
NotificationCenter.default.addObserver(self, selector: #selector(defaultsChanged), name: UserDefaults.didChangeNotification, object: nil)
defaultsChanged()
Logger.statistics.log("[SettingsBundleService] – added Settings Bundle observing")
}
private func registerSettingsBundle(){
let appDefaults = [String: AnyObject]()
UserDefaults.standard.register(defaults: appDefaults)
}
@objc
private func defaultsChanged(){
self.test = UserDefaults.standard.bool(forKey: "enable_feature_preference")
Logger.statistics.log("[SettingsBundleService] – changed: \(test)")
}
deinit {
NotificationCenter.default.removeObserver(self)
Logger.statistics.log("[SettingsBundleService] – removed Settings Bundle observing")
}
Could somebody advise me on what I am doing wrong here?
this is an email I have sent to Apple with no luck:
Dear Apple Developer Support Team,
I am writing to seek urgent assistance with a persistent issue I
have been encountering with Xcode. For several months now, every
time I connect my iPhone to Xcode for development purposes, it
automatically overwrites the user data of my apps with an old,
seemingly random container. This issue is severely impacting my
ability to continue development, as I cannot test new changes
effectively. This occurs since a few months in every iOS and
Xcode/macOS Version. I tried it with different Apps and Devices.
Sometimes the entire Container (Documents) gets read only access so
no new data can be created or changed by the user.
I frequently used the replace container feature on Xcode so maybe
this has something to do with it.
This problem persists despite numerous attempts to resolve it on my
end. I am at a critical point in my development timeline, and it is
crucial for me to resolve this as soon as possible.
Could you please advise on the next steps I should take to address
this issue? If there are any logs or further information you
require, I am more than willing to provide them.
Thank you for your attention to this matter. I look forward to your
prompt response and hope for a resolution soon.
Best regards,
Victor Lobe
iPad mini device with iPadOS 17.4.1.
I get this failure on iPad mini device exclusively. I have universal app and I doesn't get this error neither on iPhone or any simulator or macOS. I tried to reset the iPad, still getting the error.
The error happens when I send the app to background from the particular app screen.
Here is the error:
error: Store failed to load.
<NSPersistentStoreDescription: 0x3004b4bd0> (type: SQLite, url: file:///dev/null) with error = Error Domain=NSCocoaErrorDomain Code=134060
"A Core Data error occurred."
UserInfo={NSLocalizedFailureReason=The configuration named 'default' does not contain any entities.} with userInfo {
NSLocalizedFailureReason = "The configuration named 'default' does not contain any entities.";
}
What error says is that it loaded the store from file:///dev/null, which is wrong. Basically it looses the model container which is added via modelContaner modificator to the root view.
The error get caused particularly by the @Environment(\.modelContext) private var modelContext call in the view on which the failure occurs. This view is deep in the view hierarchy, and it get's created in the navigationDestination block.
I fixed the error by supplying modelContainer one more time right on the view:
.navigationDestination(for: File.self) { file in
FileEditor(file: file)
.modelContainer(FolderService.modelContainer)
}
I wonder, why can it loose the model container which is supplied on the root view?
When attempting to add a recent build to an External test group, I am receiving the error:
This build is using a beta version of Xcode and can’t be submitted. Make sure you’re using the latest version of Xcode or the latest seed release found on the releases tab in News and Updates
This build is a macOS app built with Unity, which is then codesigned, packaged with productbuild, and then uploaded with xcrun altool --upload-package.
The version of Xcode being used was released about a week ago.
Xcode Version 15.4 (15F31d), built of an Intel Mac Mini running macOS 14.4.1 (23E224).
I have seen threads in the past about this, but nothing recent. (1,2)
Hello,
I can't delete my app because my subscription group was in 'Waiting for Review' status. Then I deleted subscriptions and all subscription groups.
The steps I followed:
Submitted app to the review (new app)
App Store Team Rejected
I decided to make changes in the app
Submitted new build for the review
App was in the status "Waiting for the review"
I decided to don't publish my app
Removed Subscription groups and removed app from the sale
Tried to delete the app
Now I can't delete the app. Is there way to delete this app?
I don't like having an app that isn't published to App Store. In other words, I don't want to see this app in the App Store Connect
I'm having an issue where when my asset catalog have more than 2 images (all have @1x @2x and @3x and PNG format), my NSImage in my NSImageView cannot be clicked. Does anyone know why this happens?
Thanks in advance!
import SwiftUI
struct ContentView: View {
@State private var window: NSWindow?
var body: some View {
VStack {
Button("Open Window") {
// Create and show the NSWindow
self.window = NSWindow(
contentRect: NSScreen.main?.frame ?? NSRect.zero,
styleMask: [.borderless],
backing: .buffered,
defer: false
)
// Set up window properties
self.window?.isOpaque = false
self.window?.hasShadow = false
self.window?.backgroundColor = .clear
self.window?.level = .screenSaver
self.window?.collectionBehavior = [.canJoinAllSpaces]
self.window?.makeKeyAndOrderFront(nil)
// Create an NSImageView
let petView = PetView()
// Add the NSImageView to the window's content view
if let contentView = self.window?.contentView {
contentView.addSubview(petView)
// Center the petView
petView.centerXAnchor.constraint(equalTo: contentView.centerXAnchor).isActive = true
petView.centerYAnchor.constraint(equalTo: contentView.centerYAnchor).isActive = true
}
}
}
}
}
class PetView: NSImageView {
override init(frame frameRect: NSRect = .zero) {
super.init(frame: frameRect)
self.image = NSImage(named: "dog_idle-1")
self.translatesAutoresizingMaskIntoConstraints = false
}
required init?(coder: NSCoder) {
super.init(coder: coder)
}
override func mouseDown(with event: NSEvent) {
print("woof!")
}
}
I've tried changing the amount of images in my asset catalog and found that 2 is the maximum amount for my NSImage to be clickable. It suppose to print "woof!" when i click on it.
i am working application ABC where user can save configuration. Then later it can be open using same file. but when i am saving this configuration file. its not showing the icon.
the application is built using qt c++..
here is my plist
what is the possible cause?
i tried directly providing path of icon in plist. i tried CFBundleSignature from ???? to ABCC
I'm new to Networking, so forgive me if this is a silly question:
In the sample code, Building a custom peer-to-peer protocol, TLS is configured as follows:
// Create TLS options using a passcode to derive a pre-shared key.
private static func tlsOptions(passcode: String) -> NWProtocolTLS.Options {
let tlsOptions = NWProtocolTLS.Options()
let authenticationKey = SymmetricKey(data: passcode.data(using: .utf8)!)
var authenticationCode = HMAC<SHA256>.authenticationCode(for: "TicTacToe".data(using: .utf8)!, using: authenticationKey)
let authenticationDispatchData = withUnsafeBytes(of: &authenticationCode) { (ptr: UnsafeRawBufferPointer) in
DispatchData(bytes: ptr)
}
sec_protocol_options_add_pre_shared_key(tlsOptions.securityProtocolOptions,
authenticationDispatchData as __DispatchData,
stringToDispatchData("TicTacToe")! as __DispatchData)
sec_protocol_options_append_tls_ciphersuite(tlsOptions.securityProtocolOptions,
tls_ciphersuite_t(rawValue: TLS_PSK_WITH_AES_128_GCM_SHA256)!)
return tlsOptions
}
The sample code touts the connection as secure ("...uses Bonjour and TLS to establish secure connections between nearby devices"), but to my untrained eye it doesn't seem so.
My reasoning is as follows: If I adapt this code as-is, so connections between two instances of my app use SymmetricKeys derived from the four-digit passcode, then wouldn't my encryption be easy to break by an adversary who sends 0000...9999 and records corresponding changes in the encryption, exposing my app to all sorts of attacks?
The sample uses the passcode to validate the connection (host user shows client user the passcode, which is manually entered), which is a feature I would like to keep in some form or another, which is why this is causing so many headaches.
Generally speaking, is there a way to secure a local peer-to-peer connection over Network.framework that doesn't involve certificates? If certificates are the only way, are there good resources you can recommend?
i made a virtual machine with the help of the tutorial on the apple developer website running macos on my m2 macbook pro. I am wondering how I can integrate my mouse in the virtual machine instead of it being on top of the app.
when i installed Game porting toolkit 1.1, i got an error such as below:
error: assignment to 'DWORD64' {aka 'long long unsigned int'} from 'PVOID' {aka 'void *'} makes integer from pointer without a cast [-Wint-conversion]
anybody who knows how to solve it
Hello,
I am facing a passkey authentication during cross device authentication. After I called completeAssertionRequest with passkeyCredential, I am encountering the issue attach and I am unable to find where the RPID mismatch is coming from and referencing from. It would be great if I could know the source of where RPID hash (found). Thanks.
Returned credential failed validation: Error Domain=com.apple.AuthenticationServicesCore.AuthorizationError Code=14 "RPID hash did not match expected value. Expected xMTokW1VIYg2DZVB9lCtheT+0n8NxHvx4HaxTPhH4bY=, found: eE1Ub2tXMVZJWWcyRFpWQjlsQ3RoZVQtMG44TnhIdng=." UserInfo={NSLocalizedFailureReason=RPID hash did not match expected value. Expected xMTokW1VIYg2DZVB9lCtheT+0n8NxHvx4HaxTPhH4bY=, found: eE1Ub2tXMVZJWWcyRFpWQjlsQ3RoZVQtMG44TnhIdng=.}
Hi, ho un'idea per un'applicazione che può rivoluzionare e agevolare riguardo l'utilizzo degli apparati video (telefoni, monitor, tv) per almeno il75/80% dell'intera popolazione mondiale.
Vorrei che fosse un'operazione realizzata inizialmente da apple ios/os e in seguito su tutti i supporti.
Mi piacerebbe creare, sviluppare o cedere l'idea ma non so proprio da dove iniziare.
potete darmi info su questo?
so che può sembrare una richiesta astrana, ma sono certo che questa app sarà una vera rivoluzione per tutti, o quasi
Grazie
Giovanni da Cagliari, Sardegna, Italia
Hi, I have an idea for an application that can revolutionize and facilitate the use of video equipment (telephones, monitors, TVs) for at least 75/80% of the entire world population.
I would like it to be an operation carried out initially by apple ios/os and later on all media.
I would like to create, develop or sell the idea but I really don't know where to start.
can you give me info on this?
I know it may seem like a strange request, but I'm sure that this app will be a real revolution for everyone, or almost everyone
Thank you
Giovanni from Italy
[Edited by Moderator]
I am using Pushkit + Callkit and I am facing issue:
I receive incoming call when device is locked screen state then I answer and end call.
The next incoming call will alway display on left corner screen device as below image.
If I receive incoming call when device is unlocked screen state, my application receive, answer call and end call normally.
hello
I am trying to detect the orientation of text in images. (each image has a label with a number but sometimes the the label is not in the right orientation and I would like two detect these cases and add a prefix to the image files)
this code is working well but when the text is upside down it considers that the text is well oriented
is it a way to distinguish the difference ?
thanks for your help !
import SwiftUI
import Vision
struct ContentView: View {
@State private var totalImages = 0
@State private var processedImages = 0
@State private var rotatedImages = 0
@State private var remainingImages = 0
var body: some View {
VStack {
Button(action: chooseDirectory) {
Text("Choisir le répertoire des images")
.padding()
}
Text("TOTAL: \(totalImages)")
Text("TRAITEES: \(processedImages)")
Text("ROTATION: \(rotatedImages)")
Text("RESTANT: \(remainingImages)")
}
.padding()
}
func chooseDirectory() {
let openPanel = NSOpenPanel()
openPanel.canChooseDirectories = true
openPanel.canChooseFiles = false
openPanel.allowsMultipleSelection = false
openPanel.begin { response in
if response == .OK, let url = openPanel.url {
processImages(in: url)
}
}
}
func processImages(in directory: URL) {
DispatchQueue.global(qos: .userInitiated).async {
do {
let fileManager = FileManager.default
let urls = try fileManager.contentsOfDirectory(at: directory, includingPropertiesForKeys: nil)
let imageUrls = urls.filter { $0.pathExtension.lowercased() == "jpg" || $0.pathExtension.lowercased() == "png" }
DispatchQueue.main.async {
self.totalImages = imageUrls.count
self.processedImages = 0
self.rotatedImages = 0
self.remainingImages = self.totalImages
}
for url in imageUrls {
self.processImage(at: url)
}
} catch {
print("Error reading contents of directory: \(error.localizedDescription)")
}
}
}
func processImage(at url: URL) {
guard let image = NSImage(contentsOf: url), let cgImage = image.cgImage(forProposedRect: nil, context: nil, hints: nil) else {
return
}
let request = VNRecognizeTextRequest { (request, error) in
if let error = error {
print("Error recognizing text: \(error.localizedDescription)")
return
}
if let results = request.results as? [VNRecognizedTextObservation], !results.isEmpty {
let orientationCorrect = self.isTextOrientationCorrect(results)
if !orientationCorrect {
self.renameFile(at: url)
DispatchQueue.main.async {
self.rotatedImages += 1
}
}
}
DispatchQueue.main.async {
self.processedImages += 1
self.remainingImages = self.totalImages - self.processedImages
}
}
let handler = VNImageRequestHandler(cgImage: cgImage, options: [:])
do {
try handler.perform([request])
} catch {
print("Error performing text recognition request: \(error.localizedDescription)")
}
}
func isTextOrientationCorrect(_ observations: [VNRecognizedTextObservation]) -> Bool {
// Placeholder for the logic to check text orientation
// This should be implemented based on your specific needs
for observation in observations {
if let recognizedText = observation.topCandidates(1).first {
let boundingBox = observation.boundingBox
let angle = atan2(boundingBox.height, boundingBox.width)
if abs(angle) > .pi / 4 {
return false
}
}
}
return true
}
func renameFile(at url: URL) {
let fileManager = FileManager.default
let directory = url.deletingLastPathComponent()
let newName = "ROTATION_" + url.lastPathComponent
let newURL = directory.appendingPathComponent(newName)
do {
try fileManager.moveItem(at: url, to: newURL)
} catch {
print("Error renaming file: \(error.localizedDescription)")
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
My applescript calls a perl script to convert a file.
When I call the perl from commandline, everything works fine.
When I call the applescript (by dropping a file on it),
this error occurs:
Can't load '/Library/Perl/5.30/darwin-thread-multi-2level/auto/Encode/Encode.bundle' for module Encode: dlopen(/Library/Perl/5.30/darwin-thread-multi-2level/auto/Encode/Encode.bundle, 0x0001): tried: '/Library/Perl/5.30/darwin-thread-multi-2level/auto/Encode/Encode.bundle' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/
which I interprete that OSA runs in Rosetta mode now.
This error did not occur at least until Mar 27, when I used it last.
Of course on the same machine.
How is it possible that OSA now is called under Rosetta?
Has there been a chacnge in Ventura 13.6.6?
How to control that this OSA runs as native arm64?
can the example from
Support external cameras in your iPadOS app
work on IOS 17.5 Iphone 15PRO ?
https://developer.apple.com/videos/play/wwdc2023/10106/