Post not yet marked as solved
I am trying to create a near real-time drawing of waveform data from within a SwiftUI app. The data is streaming in from the hardware and I've verified that the draw(in ctx: CGContext) override in my custom CALayer is getting called. I have added this custom CALayer class as a sublayer to a UIView instance that I am making available via the UIViewRepresentable protocol.
The only time I see updated output from the CALayer is when I rotate the device and layout happens (I assume). How can I force SwiftUI to update every time I render new data in my CALayer?
More Info:
I'm porting an app from the Windows desktop. Previously, I tried to make this work by simply generating a new UIImage from a CGContext every time I wanted to update the display. I quickly exhausted memory with that technique because a new context is being created every time I call UIGraphicsImageRenderer(size:).image { context in }. What I really wanted was something equivalent to a GDI WritableBitmap. Apparently this animal allows a programmer to continuously update and re-use the contents. I could not figure out how to do this in Swift without dropping down to the old CGBitmapContext stuff written in C and even then I wasn't sure if that would give me a reusable context that I could output in SwiftUI each time I refreshed it. CALayer seemed like the answer. I welcome any feedback on a better way to do what I'm trying to accomplish.
Post not yet marked as solved
I am trying to migrate some of my mapkit code to the Map Server API. My JWT is fine and I can use that within the API Playground just fine. However, when I try to implement a test using PHP and cURL to get my Map token, I receive a 401 Not Authorized Error. My code is below:
<?php
$URL="https://maps-api.apple.com/v1/token";
$accesstoken = "<MY TOKEN HERE>";
$authorization = 'Authorization: Bearer'.$accesstoken;
$headers = [];
$ch = curl_init($URL);
curl_setopt($ch, CURLOPT_HTTPHEADER, [$authorization]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HEADERFUNCTION,
function($curl, $header) use (&$headers)
{
$len = strlen($header);
$header = explode(':', $header, 2);
if (count($header) < 2) // ignore invalid headers
return $len;
$headers[strtolower(trim($header[0]))][] = trim($header[1]);
return $len;
}
);
$result=curl_exec($ch);
$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); //get status code
curl_close ($ch);
print_r($headers);
echo($result);
echo($status_code);
?>
Now the exact response that I am receiving is:
Array ( [date] => Array ( [0] => Thu, 18 Apr 2024 18:32:15 GMT ) [content-type] => Array ( [0] => application/json;charset=utf8 ) [content-length] => Array ( [0] => 51 ) [connection] => Array ( [0] => keep-alive ) [cache-control] => Array ( [0] => max-age=0 ) [x-rid] => Array ( [0] => c9507281-bc32-46ac-be3b-dc59e97e7fed ) [strict-transport-security] => Array ( [0] => max-age=31536000; includeSubDomains; ) )
{"error":{"message":"Not Authorized","details":[]}}
401
Any help getting this to work would be appreciated.
Post not yet marked as solved
I'm implementing a bitonic sort in Metal with a Swift app. This requires 100's kernel dispatch calls for each of the swap stages which touch the whole array, the work required by the GPU is small. I haven't been able to get this to run fast enough in Swift and it seems its due to a high overhead for each dispatchThread command. I rewrote the test program in Objective C with a super-simple kernel function and its runs 25x faster from Objective C!
Kernel function
kernel void fill(device uint8_t *array [[buffer(0)]],
const device uint32_t &N [[buffer(1)]],
const device uint8_t &value [[buffer(2)]],
uint i [[thread_position_in_grid]])
{
if (i < N) {
array[i] = value;
}
}
The Swift code is:
func fill(pso:MTLComputePipelineState, buffer:MTLBuffer, N: Int, passes: Int) {
guard let commandBuffer = commandQueue.makeCommandBuffer() else { return }
let gridSize = MTLSizeMake(N, 1, 1)
var threadGroupSize = pso.maxTotalThreadsPerThreadgroup
if (threadGroupSize > N) {
threadGroupSize = N;
}
let threadgroupSize = MTLSizeMake(threadGroupSize, 1, 1);
for pass in 0..<passes {
guard let computeEncoder = commandBuffer.makeComputeCommandEncoder() else { return }
var value:UInt8 = UInt8(pass);
var NN:UInt32 = UInt32(N);
computeEncoder.setComputePipelineState(pso)
computeEncoder.setBuffer(buffer, offset: 0, index: 0)
computeEncoder.setBytes(&NN, length: MemoryLayout<UInt32>.size, index: 1)
computeEncoder.setBytes(&value, length: MemoryLayout<UInt8>.size, index: 2)
computeEncoder.dispatchThreadgroups(gridSize, threadsPerThreadgroup: threadgroupSize)
computeEncoder.endEncoding()
}
commandBuffer.commit()
commandBuffer.waitUntilCompleted()
}
let device = MTLCreateSystemDefaultDevice()!
let library = device.makeDefaultLibrary()!
let commandQueue = device.makeCommandQueue()!
let funcFill = library.makeFunction(name: "fill")!
let pso = try? device.makeComputePipelineState(function: funcFill)
var N = 16384
let passes = 100
let buffer = device.makeBuffer(length:N, options: [.storageModePrivate])!
for _ in 1...10 {
let startTime = DispatchTime.now()
fill(pso:pso!, buffer:buffer, N:N, passes:passes)
let endTime = DispatchTime.now()
let elapsedTime = endTime.uptimeNanoseconds - startTime.uptimeNanoseconds
print("Elapsed time:", Float(elapsedTime)/1_000_000, "ms");
}
and the Objective C code (which should be almost identical) is
void fill(id<MTLCommandQueue> commandQueue,
id<MTLComputePipelineState> funcPSO,
id<MTLBuffer> A,
uint32_t N,
int passes) {
id<MTLCommandBuffer> commandBuffer = [commandQueue commandBuffer];
MTLSize gridSize = MTLSizeMake(N, 1, 1);
NSUInteger threadGroupSize = funcPSO.maxTotalThreadsPerThreadgroup;
if (threadGroupSize > N) {
threadGroupSize = N;
}
MTLSize threadgroupSize = MTLSizeMake(threadGroupSize, 1, 1);
for(uint8_t pass=0; pass<passes; pass++)
{
id<MTLComputeCommandEncoder> computeEncoder = [commandBuffer computeCommandEncoder];
[computeEncoder setComputePipelineState:funcPSO];
[computeEncoder setBuffer:A offset:0 atIndex:0];
[computeEncoder setBytes:&N length:sizeof(uint32_t) atIndex:1];
[computeEncoder setBytes:&pass length:sizeof(uint8_t) atIndex:2];
[computeEncoder dispatchThreads:gridSize threadsPerThreadgroup:threadgroupSize];
[computeEncoder endEncoding];
}
[commandBuffer commit];
[commandBuffer waitUntilCompleted];
}
int main() {
NSError *error;
id<MTLDevice> device = MTLCreateSystemDefaultDevice();
id<MTLLibrary> library = [device newDefaultLibrary];
id<MTLCommandQueue> commandQueue = [device newCommandQueue];
id<MTLFunction> funcFill = [library newFunctionWithName:@"fill"];
id<MTLComputePipelineState> pso = [device newComputePipelineStateWithFunction:funcFill error:&error];
// Prepare data
int N = 16384;
int passes = 100;
id<MTLBuffer> bufferA = [device newBufferWithLength:N options:MTLResourceStorageModePrivate];
for(int it=1; it<=10; it++)
{
CFTimeInterval startTime = CFAbsoluteTimeGetCurrent();
fill(commandQueue, pso, bufferA, N, passes);
CFTimeInterval duration = CFAbsoluteTimeGetCurrent() - startTime;
NSLog(@"Elapsed time: %.1f ms", 1000*duration);
}
}
The Swift output is:
Elapsed time: 89.35556 ms
Elapsed time: 63.243744 ms
Elapsed time: 62.39568 ms
Elapsed time: 62.183224 ms
Elapsed time: 63.741913 ms
Elapsed time: 63.59463 ms
Elapsed time: 62.378654 ms
Elapsed time: 61.746098 ms
Elapsed time: 61.530384 ms
Elapsed time: 60.88774 ms
The objective C output is
2024-04-18 19:27:45.704 compute_test[3489:92754] Elapsed time: 3.6 ms
2024-04-18 19:27:45.706 compute_test[3489:92754] Elapsed time: 2.6 ms
2024-04-18 19:27:45.709 compute_test[3489:92754] Elapsed time: 2.6 ms
2024-04-18 19:27:45.712 compute_test[3489:92754] Elapsed time: 2.6 ms
2024-04-18 19:27:45.714 compute_test[3489:92754] Elapsed time: 2.7 ms
2024-04-18 19:27:45.717 compute_test[3489:92754] Elapsed time: 2.8 ms
2024-04-18 19:27:45.720 compute_test[3489:92754] Elapsed time: 2.8 ms
2024-04-18 19:27:45.723 compute_test[3489:92754] Elapsed time: 2.7 ms
2024-04-18 19:27:45.726 compute_test[3489:92754] Elapsed time: 2.5 ms
2024-04-18 19:27:45.728 compute_test[3489:92754] Elapsed time: 2.5 ms
I compile the Swift code for Release, optimised for speed.
I can't believe there should be a difference here, so what could be different, and what might I be doing wrong?
thanks
Adrian
Post not yet marked as solved
I'm building a Mac OSX Menubar app (build target is 14.0) and need a Settings window as part of it. I define the window as a standalone view in my @main block as follows:
struct xyzApp: App {
MenuBarExtra {
MenubarView()
} label: {
Label("XYZ", image: "xyz")
}
.menuBarExtraStyle(.window)
Window("Settings", id: "settings-window") {
SettingsView()
}.windowResizability(.contentSize)
}
The Settings view looks like this
var body: some View {
TabView {
Form {
}.tabItem { Label("Tab1",systemImage: "gear") }
Form {
}.tabItem { Label("Tab2",systemImage: "gear") }
}
}
}
However the Tabview is not being rendered correctly, there's no image and the sizing is wrong
I tested the same code on a regular app with a Settings() declaration in the @main block and it works fine. Any points on what I'm doing wrong would be very helpful.
Thanks!
Post not yet marked as solved
I know apple updated their policy related to sign in (see https://developer.apple.com/news/?id=f1v8pyay, "More flexibility for sign in options in apps" section), but the wording of the guidelines (https://developer.apple.com/app-store/review/guidelines/#login-services) is a bit difficult to understand:
Apps that use a third-party or social login service (such as Facebook Login, Google Sign-In, Sign in with Twitter, Sign In with LinkedIn, Login with Amazon, or WeChat Login) to set up or authenticate the user’s primary account with the app must also offer as an equivalent option another login service with the following features:
the login service limits data collection to the user’s name and email address;
the login service allows users to keep their email address private as part of setting up their account; and
the login service does not collect interactions with your app for advertising purposes without consent.
As far as I can tell, FB, Google, Amazon, etc. do not offer these protections.
Would Apple Sign In still be required in this case?
Post not yet marked as solved
I'm trying to build a project with a moderately complex Reality Composer Pro project, but am unable to because my Mac mini (2023, 8GB RAM) keeps running out of memory.
I'm wondering if there are any known memory leaks in realitytool, but basically the tool is taking up 20-30GB (!) memory during builds.
I have a Mac Pro for content creation, which is why I didn't go for more RAM on the mini – it was supposed to just be a build machine for Apple Silicon compatibility, as my Pro is Intel.
But, I'm kinda stuck here.
I have a scene that builds fine, but any time I had a USD – in this case a tree asset – with lots of instances, or a lot of geometry, I run into the memory issue. I've tried greatly simplifying the model, but even a 2MB USD is resulting in the crash. I'm failing to see how adding a 2MB asset would cause the memory of realitytool to balloon so much during builds.
If someone from Apple is willing to look, I can provide the scene – but it's proprietary so I can't just post it publicly here.
Hi All,
Our "Account Holder" has invited a new user to our corporate dev account in order for them to participate in our new round of TestFlight testing. When they follow the link in the invitation and attempt to "Create Your Apple ID" and enter the special code displayed on the screen correctly they receive a dialog:
Your request could not be completed at this time.
Your account cannot be created at this time.
They've been trying over the last few days so it seems unlikely this is a backend issue (but who knows). I also (in desperation) tried resending them an invite and they had the exact same result.
Hopefully someone here has seen (or is seeing) this issue and perhaps has an idea of how to resolve this.
Thanks very much in advance,
Eric
Post not yet marked as solved
Hello, I'm trying to get a better understanding of the SMS.db tables and fields. Does anybody have a document that describes each table and the fields within that table? I'd like to understand what each field in the Messages Table is used for but it would be a bonus if the is info is also available for the other tables contained in the SMS.db as well.
Post not yet marked as solved
Hi everyone,
I'm working on submitting my app to the App Store and need to capture screenshots for the 5.5-inch iPhone display size (iPhone 6 Plus, 7 Plus, and 8 Plus). Unfortunately, Xcode 17.4 doesn't offer simulators for these devices.
I've searched Apple's support resources but haven't found any solutions. Would anyone have suggestions on how to generate the required 5.5-inch screenshots for App Store submission?
Thanks in advance for your help!
Post not yet marked as solved
I want to distribute my app as unlisted, review team also recommends me this. 12th of April I submitted the request and got bot mail about awaiting maximum of 3 business days. I has been carrying about this all this time, so that submitted another one request yesterday. Review team always replies very fast in hours, but apple support which is processing my request confuses me.
Is here somebody with same trouble or how much time have you been awaiting for feedback?
P.S.: I can wait, but I don't see any progress and afraid of non-processing of my request because there was notification about max 3 days of awaiting, but at least a week has been gone.
Post not yet marked as solved
Description says this event will be raised when "An identifier for a process that notifies endpoint security that it is updating a file." What does this mean ?
Similarly when will ES_EVENT_TYPE_NOTIFY_FILE_PROVIDER_MATERIALIZE event be raised ?
Do these events get raised if any cloud provider sync app like Google Drive/Dropbox/OneDrive that usages fileprovider framework to sync the data ?
In my endpoint secutiry app, I have registered for these events but i didnt receive any event
*i do receive other endpoint secutiry events like ES_EVENT_TYPE_NOTIFY_CLONE etc.
Post not yet marked as solved
I have testd with TestFlight but after I changed some code and info.plist, suddenly it says "Invalid Binary". Here are my info.plist changed which I got from my github repo.
Diff
code-block
--- a/ios/Runner/Info.plist
+++ b/ios/Runner/Info.plist
@@ -2,22 +2,14 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
- <key>LSApplicationQueriesSchemes</key>
- <array>
- <string>https</string>
- </array>
- <key>NSPhotoLibraryUsageDescription</key>
- <string>Enlingo needs access to your photo library to save your profile picture.</string>
- <key>NSCameraUsageDescription</key>
- <string>Enlingo needs access to your camera to take a profile picture.</string>
- <key>NSMicrophoneUsageDescription</key>
- <string>Enlingo needs access to your microphone to record your voice.</string>
+ <key>ITSAppUsesNonExemptEncryption</key>
+ <false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
- <string>Enlingo</string>
+ <string>EnLingo</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
@@ -27,7 +19,18 @@
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
+ <string>ja</string>
<string>ko</string>
+ <string>hi</string>
+ <string>es</string>
+ <string>fr</string>
+ <string>de</string>
+ <string>pt</string>
+ <string>en</string>
+ <string>vi</string>
+ <string>zh_CN</string>
+ <string>zh_TW</string>
+ <string>zh</string>
</array>
<key>CFBundleName</key>
<string>enlingo</string>
@@ -54,8 +57,18 @@
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>FLTEnableImpeller</key>
<false/>
+ <key>LSApplicationQueriesSchemes</key>
+ <array>
+ <string>https</string>
+ </array>
<key>LSRequiresIPhoneOS</key>
<true/>
+ <key>NSCameraUsageDescription</key>
+ <string>Enlingo needs access to your camera to take a profile picture.</string>
+ <key>NSMicrophoneUsageDescription</key>
+ <string>Enlingo needs access to your microphone to record your voice.</string>
+ <key>NSPhotoLibraryUsageDescription</key>
+ <string>Enlingo needs access to your photo library to save your profile picture.</string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>Enlingo needs access to your microphone to record your voice.</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
@@ -69,15 +82,10 @@
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
- <string>UIInterfaceOrientationLandscapeLeft</string>
- <string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
- <string>UIInterfaceOrientationPortraitUpsideDown</string>
- <string>UIInterfaceOrientationLandscapeLeft</string>
- <string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
any suggestion or help would be appreciated...
and one more question...
I tested with storekit in XCode with copy-scheme.
Is it relevant to "Invalid Binary" that I have storekit cert and configuration?
I know it sounds ridiculous - catch a straw....
Post not yet marked as solved
Hello, I uploaded my app for review and the status is "waiting review", I have tried many things since March 28th, creating a new review, requesting support for feedback,... and nothing.
Does anyone know what I should do to get feedback or a deadline for publishing my app?
Thanks in advance
Leonardo
Post not yet marked as solved
Hi, I was working on some new filtering logic for my Content Filter that I would like to add. It involves making requests to remote DNS resolvers. Is it possible to use it within sync override func handleNewFlow(_ flow: NEFilterFlow) -> NEFilterNewFlowVerdict of the NEFilterDataProvider?
As of right now, I have a concept working in Command Line Tool and playground, however, when I try to add working module to the main project, it's not working (connections are not loading).
Function that makes requests to the servers: In this function I use DispatchGroup and notify for non-main queue
@available(iOS 12, *)
public class NetworkService {
private let nonMainQueue: DispatchQueue = DispatchQueue(label: "non-main-queue")
func isBlocked(hostname: String, completion: @escaping (Bool) -> Void) {
var isAnyBlocked = false
let group = DispatchGroup()
for server in servers {
group.enter()
let endpoint = NWEndpoint.Host(server)
query(host: endpoint, domain: hostname, queue: .global()) { response, error in
defer {
group.leave()
}
/*
* some code that determines the filtering logic
* if condition is true => isAnyBlocked = true & return
*/
}
}
group.notify(queue: nonMainQueue) {
completion(isAnyBlocked)
}
}
}
And, for example, in playground Semaphores make it work as expected, but the same approach doesn't work with the NEFilterDataProvider
playground code sample
let hostname = "google.com"
func returnResponse() -> String {
var result = ""
let semaphore = DispatchSemaphore(value: 0)
DispatchQueue.global().async {
NetworkService.isBlocked(hostname: hostname) { isBlocked in
result = isBlocked ? "blocked" : "allowed"
semaphore.signal()
}
}
semaphore.wait()
return result
}
print(returnResponse())
Output: allowed
Post not yet marked as solved
Hi, I'm trying to achieve the following OpenSSL workflow in Swift.
I have this intermediate certificate from Let's encrypt and I want to extract the public key from it and then hash it with SHA-256 and finally encide it in base64.
The OpenSSL commands that achieve this look like this:
openssl x509 -in isrgrootx1.pem -pubkey -noout > publickey.pem
openssl rsa -pubin -in publickey.pem -outform der | openssl dgst -sha256 -binary | openssl enc -base64
I've tried Security, CommonCrypto, CryptoKit frameworks with no success. I was able to get the public key out of the certificate but its PEM representation seems to slightly differ from what I get with OpenSSL. At the beginning of the public jet, the OpenSSL version has a string that is not present on what I get with Swift but the rest is the same.
This is the Swift code to use:
import Foundation
import Security
import CommonCrypto
// Step 1: Extract public key from the certificate
func extractPublicKey(from certificate: SecCertificate) -> SecKey? {
// Extract public key from the certificate
var publicKey: SecKey?
if let publicKeyRef = SecCertificateCopyKey(certificate) {
publicKey = publicKeyRef
}
return publicKey
}
// Step 2: Calculate SHA-256 hash of the public key
func calculateSHA256(of data: Data) -> Data {
var hash = [UInt8](repeating: 0, count: Int(CC_SHA256_DIGEST_LENGTH))
data.withUnsafeBytes {
_ = CC_SHA256($0.baseAddress, CC_LONG(data.count), &hash)
}
return Data(hash)
}
// Step 3: Encode data as base64
func base64EncodedString(from data: Data) -> String {
return data.base64EncodedString()
}
// Step 4: Main function to perform all steps
func processCertificate(certificate: SecCertificate) {
// Step 1: Extract public key
guard let publicKey = extractPublicKey(from: certificate) else {
return
}
// Step 2: Export public key as data
guard let publicKeyData = SecKeyCopyExternalRepresentation(publicKey, nil) as Data? else {
print("Failed to export public key data")
return
}
// Step 3: Calculate SHA-256 hash of the public key
let sha256Hash = calculateSHA256(of: publicKeyData)
// Step 4: Encode SHA-256 hash as base64
let base64EncodedHash = base64EncodedString(from: sha256Hash)
print("SHA-256 hash of public key (base64 encoded): \(base64EncodedHash)")
}
This is the Public Key I get with OpenSSL:
-----BEGIN PUBLIC KEY-----
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAregkc/QUN/ObnitXKByHvty33ziQjG485legePd1wqL+9Wpu9gBPKNveaIZsRJO2sWP9FBJrvx/S6jGbIX7RMzy6SPXded+zuP8S8SGaS8GKhnFpSmZmbI9+PHC/rSkiBvPkwOaAruJLj7eZfpQDn9NHl3yZSCNT6DiuTwpvgy7RSVeMgHS22i/QOI17A3AhG3XyMDz6j67d2mOr6xZPwo4RS37PC+j/tXcu9LJ7SuBMEiUMcI0DKaDhUyTsE9nuGb8Qs0qMP4mjYVHerIcHlPRjcewu4m9bmIHhiVw0eWx27zuQYnnm26SaLybF0BDhDt7ZEI4W+7f3qPfH5QIHmI82CJXn4jeWDTZ1nvsOcrEdm7wD+UkF2IHdBbQq1kHprAF2lQoP2N/VvRIfNS8oF2zSmMGoCWR3bkc3us6sWV5onX9y1onFBkEpPlk+3Sb1JMkRp1qjTEAfRqGZtac6UW6GO559cqcSBXhZ7T5ReBULA4+N0C8Fsj57ShxLcwUS/Mbq4FATfEOTdLPKdOeOHwEI0DDUW3E2tAe6wTAwXEi3gjuYpn1giqKjKYLMur2DBBuigwNBodYF8RvCtvCofIY7RqhIKojcdpp2vx9qpT0Zj+s482TeyCsNCij/99viFULUItAnXeF5/hjncIitTubZizrG3SdRbv+8ZPUzQ08CAwEAAQ==
-----END PUBLIC KEY-----
and this is what I get with Swift:
-----BEGIN PUBLIC KEY-----
MIICCgKCAgEAregkc/QUN/ObnitXKByHvty33ziQjG485legePd1wqL+9Wpu9gBPKNveaIZsRJO2sWP9FBJrvx/S6jGbIX7RMzy6SPXded+zuP8S8SGaS8GKhnFpSmZmbI9+PHC/rSkiBvPkwOaAruJLj7eZfpQDn9NHl3yZSCNT6DiuTwpvgy7RSVeMgHS22i/QOI17A3AhG3XyMDz6j67d2mOr6xZPwo4RS37PC+j/tXcu9LJ7SuBMEiUMcI0DKaDhUyTsE9nuGb8Qs0qMP4mjYVHerIcHlPRjcewu4m9bmIHhiVw0eWx27zuQYnnm26SaLybF0BDhDt7ZEI4W+7f3qPfH5QIHmI82CJXn4jeWDTZ1nvsOcrEdm7wD+UkF2IHdBbQq1kHprAF2lQoP2N/VvRIfNS8oF2zSmMGoCWR3bkc3us6sWV5onX9y1onFBkEpPlk+3Sb1JMkRp1qjTEAfRqGZtac6UW6GO559cqcSBXhZ7T5ReBULA4+N0C8Fsj57ShxLcwUS/Mbq4FATfEOTdLPKdOeOHwEI0DDUW3E2tAe6wTAwXEi3gjuYpn1giqKjKYLMur2DBBuigwNBodYF8RvCtvCofIY7RqhIKojcdpp2vx9qpT0Zj+s482TeyCsNCij/99viFULUItAnXeF5/hjncIitTubZizrG3SdRbv+8ZPUzQ08CAwEAAQ==
-----END PUBLIC KEY-----
Interestingly, if I use the Swift version of the Public Key I get and then run the second command I still get the correct final result. Unfortunately in Swift I don't get the correct final result.
I suspect it must be something about headers since I was able to get the correct output on OpenSSL with the public key I got using the Swift.
Any ideas?
Post not yet marked as solved
MacOS Version: 14.3 (23D56)
In my testing of PacketTunnelProvider on MacOS I have observed that when I do a system shutdown or reboot, PacketTunnelProvider::stopTunnelWithReason() is getting called with reason: NEProviderStopReasonUserInitiated. Note: when I try to disconnect the VPN from system settings PacketTunnelProvider::stopTunnelWithReason() is called with the same reason: NEProviderStopReasonUserInitiated.
I am facing an issue here to identify what caused PacketTunnelProvider::stopTunnelWithReason(), system shutdown or any user action?
Post not yet marked as solved
I would like to specify "Connection: close" for a request that I load in WKWebView - which actually CAN be done by setting the value on the request that is loaded (and it actually works). However, the documentation at https://developer.apple.com/documentation/foundation/nsurlrequest#1776617 states that it shouldn't be used because the URL loading system handles persistent connections for you.
So - my question is how can I indicate to the URL Loading System that I do NOT want to use persistent connections for this particular request? Or - am I safe to just set the header even though it's listed as reserved (because - as mentioned - it does work)?
Post not yet marked as solved
Im using Notions API to print out some data from one of my own pages in notion and im using URLSession to make the request then parsing the unwrapped data but nothing is being returned to my console and I know my endpoint and API key is correct. I've gone through the notion API documentation can't can't seem to find anything in it that I am not doing or doing wrong. Ill provide my code as well as the documentation I've been consulting: https://developers.notion.com/reference/intro
import Foundation
struct Page: Codable {
let id: String
let title: String
}
let endpoint = URL(string: "https://api.notion.com/v1/pages/8efc0ca3d9cc44fbb1f34383b794b817")
let apiKey = "secret_p8m6hNziho8DukmEuQbd2YVY9ihPs4eNlUyR6wZZICM"
let session = URLSession.shared
func makeRequest() {
if let endpoint = endpoint {
let task = URLSession.shared.dataTask(with: endpoint) { data, response, error in
if let taskError = error {
print("could not establish url request:\(taskError)")
return
}
if let unwrapData = data { //safely unwrapping the data value using if let
do {
let decoder = JSONDecoder() //JSONDecoder method to decode api data,
let codeUnwrappedData = try decoder.decode(Page.self,from: unwrapData) //type: specifies its a struct, from: passes the data parmeter that contains the api data to be decoded
} catch {
print("could not parse json data")
}
}
if let httpResponse = response as? HTTPURLResponse {
if httpResponse.statusCode == 200 {
if let apiData = data {
print(String(data: apiData, encoding: .utf8)!)
}
} else {
print("unsuccessful http response:\(httpResponse)")
}
makeRequest()
}
}
task.resume()
}
}
Post not yet marked as solved
Hello everyone,
I have a app for Driver to pay in-store (fuel, garage, etc.) and would like to build a feature that can activate Apple Pay from my app so that Driver can use it to pay with POS terminal instead of double click the Home button. Is it possible?
Post not yet marked as solved
Archive a package.
[Window] -> [Organizer] -> select package just archived -> click [Distribute App]
select [App Store Connect] -> click [Distribute] -> CRASH!
crash log
Process: Xcode [12835]
Path: /Applications/Xcode.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 15.3 (22618)
Build Info: IDEApplication-22618000000000000~2 (15E204a)
App Item ID: 497799835
App External ID: 863955376
Code Type: ARM-64 (Native)
Parent Process: launchd [1]
User ID: 501
Date/Time: 2024-04-15 11:05:05.6599 +0800
OS Version: macOS 14.4.1 (23E224)
Report Version: 12
Anonymous UUID: E74ED973-D26C-0B5C-FDB1-837215F4F6B9
Sleep/Wake UUID: 6627EBDD-D3B7-4988-B9E5-BEDB5E1ED228
Time Awake Since Boot: 92000 seconds
Time Since Wake: 11424 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: Namespace SIGNAL, Code 6 Abort trap: 6
Terminating Process: Xcode [12835]
Application Specific Information:
abort() called
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x194e6aa60 __pthread_kill + 8
1 libsystem_pthread.dylib 0x194ea2c20 pthread_kill + 288
2 libsystem_c.dylib 0x194dafa20 abort + 180
3 libswiftCore.dylib 0x1a4f049f4 swift::fatalErrorv(unsigned int, char const*, char*) + 128
4 libswiftCore.dylib 0x1a4f04a14 swift::fatalError(unsigned int, char const*, ...) + 32
5 libswiftCore.dylib 0x1a4f04be0 swift::swift_abortRetainUnowned(void const*) + 48
6 libswiftCore.dylib 0x1a4f08f10 swift_unownedRetainStrong + 140
7 SwiftUI 0x1c1cea47c 0x1c075f000 + 22590588
8 SwiftUI 0x1c1cea42c 0x1c075f000 + 22590508
9 AppKit 0x198c517d4 -[_NSQuickActionAutovalidationScheduler windowDidUpdate:] + 140
10 CoreFoundation 0x194f76b1c __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148
11 CoreFoundation 0x19500adb8 ___CFXRegistrationPost_block_invoke + 88
12 CoreFoundation 0x19500ad00 _CFXRegistrationPost + 440
13 CoreFoundation 0x194f45648 _CFXNotificationPost + 768
14 Foundation 0x196061464 -[NSNotificationCenter postNotificationName:object:userInfo:] + 88
15 CoreFoundation 0x194fadd4c -[NSArray makeObjectsPerformSelector:] + 212
16 AppKit 0x1987dccb4 -[NSApplication(NSWindowCache) _updateWindowsUsingCache] + 108
17 AppKit 0x1987dcc0c -[NSApplication updateWindows] + 64
18 AppKit 0x198c19a3c __38-[NSApplication setWindowsNeedUpdate:]_block_invoke_2 + 56
19 AppKit 0x198c1eb6c ___NSRunLoopObserverCreateWithHandler_block_invoke + 64
20 CoreFoundation 0x194f81254 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 36
21 CoreFoundation 0x194f81140 __CFRunLoopDoObservers + 536
22 CoreFoundation 0x194f8076c __CFRunLoopRun + 776
23 CoreFoundation 0x194f7fe0c CFRunLoopRunSpecific + 608
24 HIToolbox 0x19f71b000 RunCurrentEventLoopInMode + 292
25 HIToolbox 0x19f71ac90 ReceiveNextEventCommon + 220
26 HIToolbox 0x19f71ab94 _BlockUntilNextEventMatchingListInModeWithFilter + 76
27 AppKit 0x1987d8970 _DPSNextEvent + 660
28 AppKit 0x198fcadec -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 700
29 DVTKit 0x10313f858 -[DVTApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 300
30 AppKit 0x1987cbcb8 -[NSApplication run] + 476
31 DVTKit 0x10313eb24 -[DVTApplication run] + 60
32 AppKit 0x1987a2f54 NSApplicationMain + 880
33 dyld 0x194b1a0e0 start + 2360