Sample Header Ad - 728x90

Ask Different (Apple)

Q&A for power users of Apple hardware and software

Latest Questions

1 votes
1 answers
663 views
Swift Playgrounds on MacOS performs badly, spinning up the fans and working the CPU
Using the basic "Learn to Code 1" playground results in the MacBooks that I've tested on, including a 2020 MacBook Air, working far harder than I'd expect. The fans spin up and the CPU usage increases more than I'd expect. The performance settles down if I leave the application running, I see the hi...
Using the basic "Learn to Code 1" playground results in the MacBooks that I've tested on, including a 2020 MacBook Air, working far harder than I'd expect. The fans spin up and the CPU usage increases more than I'd expect. The performance settles down if I leave the application running, I see the high load whenever I type and change the program. The app is compiling some Swift code and displaying a fairly simple game interface to show the results. What can account for this poor performance on a capable machine?
David B (121 rep)
Jun 3, 2020, 08:38 AM • Last activity: Jun 13, 2024, 05:03 AM
1 votes
1 answers
43 views
Apple programming-libraries & software: What's the meaning of the prefix "Core"?
Many Apple-libraries got this Prefix "Core", like for example "Core Location", "Core Data", "Core Graphics", "Core Storage". **What's the meaning of "Core ..."? Where does it come from?**
Many Apple-libraries got this Prefix "Core", like for example "Core Location", "Core Data", "Core Graphics", "Core Storage". **What's the meaning of "Core ..."? Where does it come from?**
mizech (1265 rep)
Jun 9, 2024, 09:36 AM • Last activity: Jun 9, 2024, 03:39 PM
0 votes
2 answers
363 views
How to decode/decompress Apple's vCard notes
I have vCards that were exported from the Contacts app of Mac OS X 10.8.2. From what I can tell, Apple exported the notes with RTF that was compressed with LZF and converted the compressed data to base 64 before exporting the vCard. I'm trying to restore an export but the current version (Sonoma 14....
I have vCards that were exported from the Contacts app of Mac OS X 10.8.2. From what I can tell, Apple exported the notes with RTF that was compressed with LZF and converted the compressed data to base 64 before exporting the vCard. I'm trying to restore an export but the current version (Sonoma 14.2.1) ignores the notes field of the vCard. (I sanitized the contact information but didn't touch the X-APPLE-OL-NOTE section.) Here's an example vCard: BEGIN:VCARD VERSION:3.0 PRODID:-//Apple Inc.//Mac OS X 10.8.2//EN N:;Jane;;;(Baker) Smith FN:Jane (Baker) Smith TEL;type=HOME;type=VOICE;type=pref:(123) 123-4567 TEL;type=CELL;type=VOICE:(321) 321-7654 item1.ADR;type=HOME;type=pref:;;123 Any Street;Any Town;XX;T1T 1T1;Canada item1.X-ABADR:ca UID:CZTL-07DB0A0E-002E-0202-FF32-00816 X-ABUID:6EB029FB-BBBB-4242-A054-C5F4392245BD:ABPerson X-EVOLUTION-FILE-AS:Smith, Jane X-APPLE-OL-MAPPING-INFO:1 X-APPLE-OL-NOTE;TYPE=text/rtf;X-COMPRESSION=X-OL;X-HASH=03c582c83054be62e05 e09df57aff23b;X-HASHALGORITHM=X-zMD5;ENCODING=B:fAAAAI0AAABMWkZ1YU/S1F8AAwF AAHIB9wK3VgSQZC0AcGECgAqScASQdzEYMTA0AUAPc2g5OIYwAUAAwHJnbDEMAd0Q4nIRMgsDDN A1DAEM0F0P4DYC0QoRAUBpAUB1VGxuAiBlAgBjAUBjAQu1IChBYnJhaGBhbXNlKQ9AFcA= END:VCARD The note in the above vCard is "(Abrahamse)". I've attempted to read the Note with the following Swift code (the above vCard is stored on disk as test.vcf): import Foundation import Contacts func readVCard(filePath: String) { do { // Read the content of the vCard file let vCardContent = try String(contentsOfFile: filePath, encoding: .utf8) // Parse the vCard data if let data = vCardContent.data(using: .utf8) { let contacts = try CNContactVCardSerialization.contacts(with: data) // Print information for each contact for contact in contacts { print("Contact Identifier: \(contact.identifier)") print("Given Name: \(contact.givenName)") for phoneNumber in contact.phoneNumbers { print("Phone Number: \(phoneNumber.value.stringValue)") } print("Notes: \(contact.note)") } } } catch { print("Error reading the vCard file: \(error.localizedDescription)") } } // Example usage: replace "test.vcf" with the actual path to your vCard file let vCardFilePath = "test.vcf" readVCard(filePath: vCardFilePath) The output of running the code is below -- the note information is not extracted properly: Contact Identifier: 2035C9D6-6A76-49F4-A5ED-C2C073A517CE:ABPerson Given Name: Jane Phone Number: (123) 123-4567 Phone Number: (321) 321-7654 Notes: Program ended with exit code: 0 I used the base64 command at the terminal to decode the notes from 2 vcards and the first few bytes were (from xxd): test.vcf: 00000000: 7c00 0000 8d00 0000 4c5a 4675 614f d2d4 |.......LZFuaO.. second.vcf: 00000000: 5e1f 0000 4f4e 0000 4c5a 4675 59f1 0eeb ^...ON..LZFuY... So the main overlap is 4c5a 4675, corresponding to LZFu. I wasn't able to match that up with the hints on the [Identifying Compression Algorithms](https://github.com/frizb/FirmwareReverseEngineering/blob/master/IdentifyingCompressionAlgorithms.md) page. How could I extract the note correctly?
fractional_ideal (1 rep)
Jan 8, 2024, 02:47 PM • Last activity: May 24, 2024, 08:29 AM
1 votes
2 answers
528 views
Is macOS `prefPane` app possible containing virus?
So I came across this unusual program, https://doomlaser.com/cursorcerer-hide-your-cursor-at-will/. I'd want to install it, however it's built using a macOS feature called `prefPane`, which lets you add a panel to your macOS preference window. When I install it, it does not warn me or scan for virus...
So I came across this unusual program, https://doomlaser.com/cursorcerer-hide-your-cursor-at-will/ . I'd want to install it, however it's built using a macOS feature called prefPane, which lets you add a panel to your macOS preference window. When I install it, it does not warn me or scan for viruses; instead, it asks if I want to install it for this user or all users. So I was wondering whether this technique might be used to contain any viruses.
Joseph (113 rep)
Feb 20, 2024, 03:48 PM • Last activity: Feb 23, 2024, 11:13 AM
0 votes
1 answers
290 views
How to debug Distributed Notification Center
I have two Swift macOS apps with running from XCode which are simple listener-notifier programs based on `DistributedNotificationCenter`. It all seems straightforward, but it is not always working. And it seems pretty random for me. Is there any way to debug this feature? Why sometimes messages is n...
I have two Swift macOS apps with running from XCode which are simple listener-notifier programs based on DistributedNotificationCenter. It all seems straightforward, but it is not always working. And it seems pretty random for me. Is there any way to debug this feature? Why sometimes messages is not received or are there maybe some leak of the listener ports? Do you know maybe any tool? I tried to use console logs but I haven't found anything interesting there. Thanks! Ps. I've noticed that notification is sent when I went machine to Sleep and the Login again. Strange
Przemekeke (67 rep)
Feb 2, 2024, 11:09 AM • Last activity: Feb 2, 2024, 11:48 AM
2 votes
1 answers
264 views
Developing a new app: Is there a way to share the app with my remote Client so he can beta test the app on his iphone?
I'm developing a simple iPhone app (using Xcode & SwiftUI) for a Client who is in another state (here in the US). I have a valid up-to-date developer account. I'd like to release the app to his iPhone so he can beta-test the app. Is this possible? Is there any way to deploy the app to his iPhone eve...
I'm developing a simple iPhone app (using Xcode & SwiftUI) for a Client who is in another state (here in the US). I have a valid up-to-date developer account. I'd like to release the app to his iPhone so he can beta-test the app. Is this possible? Is there any way to deploy the app to his iPhone even though he is geographically distant (and cannot connect his iPhone to my development Mac)?
raddevus (163 rep)
Jan 24, 2024, 09:05 PM • Last activity: Jan 24, 2024, 10:29 PM
0 votes
1 answers
67 views
How to tell Applescript to call a Fondation's class's init?
A subquestion could be: how to find the AppleScript name of a class's instances? Context: I use the following to access NSTimeZone variables and apply methods. ``` use scripting additions -- essential to use (current date) with framework "Foundation" use framework "Foundation" tell class "NSTimeZone...
A subquestion could be: how to find the AppleScript name of a class's instances? Context: I use the following to access NSTimeZone variables and apply methods.
use scripting additions -- essential to use (current date) with framework "Foundation"
use framework "Foundation"
    
tell class "NSTimeZone" of current application to resetSystemTimeZone()
    
set aTZ to current application's NSTimeZone
set localZone to aTZ's localTimeZone()
set defaultZone to aTZ's defaultTimeZone()
set aDate to (current date)
    
defaultZone's |name|() as string
defaultZone's abbreviation as string
defaultZone's abbreviationForDate:aDate
defaultZone's daylightSavingTimeOffsetForDate:aDate
defaultZone's secondsFromGMT()
defaultZone's secondsFromGMTForDate:aDate
etc. In Apple documentation , the last line above intended for SWIFT describes the use like this: func secondsFromGMT(for aDate: Date) -> Int It was hard to find the correct formulation for Applescript (secondsFromGMTForDate:aDate) but I figured it out. What I cannot conceive though is how to call an initializer like these ones described for SWIFT:
init?(name tzName: String)  
convenience init(forSecondsFromGMT seconds: Int)
Based on the previous pattern I tried all kind of formulations like these:
defaultZone's initWithName:"America/Toronto"  
tell defaultZone to initName:"EST"  
tell defaultZone to initNameString:"EST"  
tell defaultZone to initTzName:"EST"  
tell class NSTimeZone of current application to set SecondsFromGMT to 3600  
tell defaultZone to initforSecondsFromGMT:3600   
tell defaultZone to init:forSecondsFromGMT  
defaultZone's initNameString("EST")
...and many other variations. I always get an error like this:
error "-[_NSSwiftTimeZone initWithName]: unrecognized selector sent to instance 0x7fc514913750" number -10000
In fact I get the same error even if I write something like
tell defaultZone to playPiano:"EST"
so I get it that I don't have the right name (selector) for the call. And maybe not the right way to call either. On top of that, case matters in the names. What is the correct way to do it? Is there a way to list the instances, variables, methods, functions of an NS class as they are referred to in Applescript?
Recycleur (3 rep)
Oct 26, 2023, 04:23 AM • Last activity: Oct 26, 2023, 04:08 PM
0 votes
1 answers
146 views
What is difference between putting a macOS app as "open at login" and putting a macOS app in "allow in the background"?
I can see on my mac there are some apps like Google Chrome that launch automatically when I start my Mac and also I can see apps like Magnet which it is not in auto launch but in allow in background. These 2 different apps both are ready to use without having to clicking on app to run it, so what is...
I can see on my mac there are some apps like Google Chrome that launch automatically when I start my Mac and also I can see apps like Magnet which it is not in auto launch but in allow in background. These 2 different apps both are ready to use without having to clicking on app to run it, so what is difference between them? If Magnet can be used when I start my Mac without clicking on app why isn't Google chrome there? I am trying to understand when I need to use auto launch and when I need use allow in background, from my understanding both doing same thing but I am confused about the correct use case of them. enter image description here
bulletproof software engineer (123 rep)
Sep 18, 2023, 06:49 PM • Last activity: Sep 18, 2023, 07:34 PM
1 votes
0 answers
138 views
How can I run bash command with having Sandbox in Swift?
I made a working app which hides and shows the desktop icons using bash the terminal command for making it, easier to do this job with an UI, it works ok without sandbox and if there is sandbox it does not. But the issue is here that According to Apple documentation, to distribute a macOS app throug...
I made a working app which hides and shows the desktop icons using bash the terminal command for making it, easier to do this job with an UI, it works ok without sandbox and if there is sandbox it does not. But the issue is here that According to Apple documentation, to distribute a macOS app through the Mac App Store, you must enable the App Sandbox capability. So if I use and keep Sandbox my code would NOT get processed and I would getting the massage of: "Operation not permitted" so how can I make my codes run with keeping the sandbox?
bulletproof software engineer (123 rep)
Sep 7, 2023, 03:18 PM • Last activity: Sep 7, 2023, 03:37 PM
4 votes
1 answers
142 views
Where do iOS Apps store their persistent keychain data when run on an M1 Mac?
iOS apps can persist data between uninstalls as explained [here](https://stackoverflow.com/questions/18911434/will-items-in-ios-keychain-survive-app-uninstall-and-reinstall) If an iOS app is run on a Mac, where would this data live? Is it accessible by the keychain viewer?
iOS apps can persist data between uninstalls as explained [here](https://stackoverflow.com/questions/18911434/will-items-in-ios-keychain-survive-app-uninstall-and-reinstall) If an iOS app is run on a Mac, where would this data live? Is it accessible by the keychain viewer?
yspreen (151 rep)
Sep 1, 2023, 03:02 PM • Last activity: Sep 5, 2023, 10:12 PM
1 votes
1 answers
825 views
Can I open any app from app store in xcode?
I just start learning iOS development and still haven't finish the course but I'm too curios to know if I can open an app from app store in xcode to see all of the code inside of it as it will make it easy to learn.
I just start learning iOS development and still haven't finish the course but I'm too curios to know if I can open an app from app store in xcode to see all of the code inside of it as it will make it easy to learn.
ms12 (13 rep)
Apr 26, 2023, 12:47 PM • Last activity: Apr 26, 2023, 02:04 PM
0 votes
0 answers
150 views
How can I tell if a macOS app is native or just a wrap around a website?
I've got a cookie notice when launching an app for the first time on macOS, which I didn't know was a thing. Looking at the processes running, I see 3 processes spawned by the app. One looks like a regular packaged app, but one reads `Pocket Casts Web Content ( )` and its name is just the url leadin...
I've got a cookie notice when launching an app for the first time on macOS, which I didn't know was a thing. Looking at the processes running, I see 3 processes spawned by the app. One looks like a regular packaged app, but one reads Pocket Casts Web Content () and its name is just the url leading to the webapp version of the app. I've only seen Web Content processes being used as browser helpers, and can't find anything in the Apple docs.
Scb (101 rep)
Feb 24, 2023, 03:54 PM
0 votes
2 answers
665 views
What happened to CreateMLUI? Has it been removed?
In my Swift project in Xcode, `import CreateMLUI` says no such module. Has this been replaced or just removed?
In my Swift project in Xcode, import CreateMLUI says no such module. Has this been replaced or just removed?
Micheal Bee (131 rep)
May 15, 2022, 09:08 PM • Last activity: Dec 16, 2022, 05:47 AM
3 votes
1 answers
387 views
Upgrade Swift without upgrading MacOS X
I am currently using Mac OS Sierra 10.12.6. I cannot upgrade to a more recent OS version as the business applications I am using for WFH will not work. The default swift installed is 3.1. I want to upgrade to Swift 5 without upgrading my OS X. I cannot upgrade Xcode as it needs the latest OS X. Is t...
I am currently using Mac OS Sierra 10.12.6. I cannot upgrade to a more recent OS version as the business applications I am using for WFH will not work. The default swift installed is 3.1. I want to upgrade to Swift 5 without upgrading my OS X. I cannot upgrade Xcode as it needs the latest OS X. Is there a way to install swift 5 as a standalone using homebrew or other methods?
CurveGamma (141 rep)
Jun 22, 2020, 08:46 PM • Last activity: Nov 24, 2022, 10:05 PM
2 votes
1 answers
886 views
chmod +x not working as expected, running another tool instead
Just wrote a simple commandline tool which works fine with `swift` but doesn't run as executable after `chmod +x ...` This is happening on my system so might be configuration related but not sure how to resolve. --- #### Create Script: vi test.swift #### Enter content: import Foundation print("Hello...
Just wrote a simple commandline tool which works fine with swift but doesn't run as executable after chmod +x ... This is happening on my system so might be configuration related but not sure how to resolve. --- #### Create Script: vi test.swift #### Enter content: import Foundation print("Hello, World!") Running normally swift test.swift gives Hello, World! as expected but when I make it executable & run it then it's failing. #### Make Executable: chmod +x test.swift ./test.swift #### Output: Version: ImageMagick 7.1.0-52 Q16-HDRI aarch64 20549 https://imagemagick.org Copyright: (C) 1999 ImageMagick Studio LLC License: https://imagemagick.org/script/license.php Features: Cipher DPC HDRI Modules OpenMP(5.0) Delegates (built-in): bzlib fontconfig freetype gslib heic jng jp2 jpeg lcms lqr ltdl lzma openexr png ps raw tiff webp xml zlib Compiler: gcc (4.2) Usage: import [options ...] [ file ] Image Settings: -adjoin join images into a single multi-image file By default, 'file' is written in the MIFF image format. To specify a particular image format, precede the filename with an image format name and a colon (i.e. ps:image) or specify the image type as the filename suffix (i.e. image.ps). Specify 'file' as '-' for standard input or output. import: delegate library support not built-in '' (X11) @ error/import.c/ImportImageCommand/1297. ./test.swift: line 3: syntax error near unexpected token `"Hello, World!"' ./test.swift: line 3: `print("Hello, World!")' Why is it running commandline tool imagemagick?
staticVoidMan (123 rep)
Nov 11, 2022, 02:12 PM • Last activity: Nov 11, 2022, 02:35 PM
1 votes
1 answers
67 views
How to disable Apple Watch SOS crash detection temporarily out of app?
I'm currently developing a Apple Watch App for surfers. I've received many requests if we can pause or disable the crash detection of a watch in case our surfers app is running to prevent automatic SOS calls during crashes on water (which happens a lot during freestyle). Has anybody came around this...
I'm currently developing a Apple Watch App for surfers. I've received many requests if we can pause or disable the crash detection of a watch in case our surfers app is running to prevent automatic SOS calls during crashes on water (which happens a lot during freestyle). Has anybody came around this topic so far? Is this even allowed by Apple? I've researched a lot but can not find anything about this topic.
Mr. Jo (113 rep)
Oct 13, 2022, 04:52 AM • Last activity: Oct 13, 2022, 06:48 AM
3 votes
1 answers
2550 views
Mac swift process blocks system, high memory pressure
Recently, since XCode 11 when I use it, builds and indexes grab a lot of memory. Activity monitor shows a process (it seems like it does so when indexing or building files) called swift and my Mac soon starts to lag. This process gathers a lot of memory (sometimes it gathers up to 70 GB) from my com...
Recently, since XCode 11 when I use it, builds and indexes grab a lot of memory. Activity monitor shows a process (it seems like it does so when indexing or building files) called swift and my Mac soon starts to lag. This process gathers a lot of memory (sometimes it gathers up to 70 GB) from my computer and I have to kill the process every time in order to get back to normal and start using my Mac as before. enter image description here enter image description here How do I stop this memory pressure from increasing this much when compiling ?
Cristian Bănărescu (39 rep)
Dec 12, 2019, 01:44 PM • Last activity: Sep 16, 2022, 10:44 AM
0 votes
0 answers
111 views
How change value of "Press Fn to" in Keyboard preferences programmatically?
I need to change value of "Press Fn to" programmatically to "Do Nothing". I can't find a direct way to switch this. I believe that is possible do this with AppleScript, but will need to trigger system preferences application in background. [![enter image description here][1]][1] [![enter image descr...
I need to change value of "Press Fn to" programmatically to "Do Nothing". I can't find a direct way to switch this. I believe that is possible do this with AppleScript, but will need to trigger system preferences application in background. enter image description here enter image description here
a_kira (101 rep)
May 5, 2022, 02:36 PM
0 votes
0 answers
1746 views
Run an AppleScript from Swift
I'm trying to return a value from AppleScript to Swift (in XCode). If I do this simple code it works: let myAppleScript = """ return "hello world" """ var error: NSDictionary? if let scriptObject = NSAppleScript(source: myAppleScript) { let output: NSAppleEventDescriptor = scriptObject.executeAndRet...
I'm trying to return a value from AppleScript to Swift (in XCode). If I do this simple code it works: let myAppleScript = """ return "hello world" """ var error: NSDictionary? if let scriptObject = NSAppleScript(source: myAppleScript) { let output: NSAppleEventDescriptor = scriptObject.executeAndReturnError(&error) print(output.stringValue) } and if I run display dialog I get the alert on the screen, though there are issues with dismissing it. But if I run this code: let myAppleScript = """ set appList to my getAppList() return appList on getAppList() tell application "System Events" return name of every application process as list end tell end getAppList """ var error: NSDictionary? if let scriptObject = NSAppleScript(source: myAppleScript) { let output: NSAppleEventDescriptor = scriptObject.executeAndReturnError(&error) print(output.stringValue) } It returns nil. I am trying to port an AppleScript I wrote to XCode to make it more dynamic and give it a UI. Am I doing something wrong or is this just not possible?
PruitIgoe (101 rep)
Dec 7, 2021, 03:04 PM
1 votes
1 answers
103 views
What password is sent when a router does not have a password set?
I promise this is not a hypothetical question. I am trying to use this GitHub repo - https://github.com/braineo/airport-bssid The latest OS X version does not allow specifying the BSSID so I am using a SSID / channel workaround. However, the router I am trying to connect to is open and does not have...
I promise this is not a hypothetical question. I am trying to use this GitHub repo - https://github.com/braineo/airport-bssid The latest OS X version does not allow specifying the BSSID so I am using a SSID / channel workaround. However, the router I am trying to connect to is open and does not have a password (I don't have any way of disabling). Thus the script requests "Input WiFi password" and nothing works. I have tried [no entry] and hitting enter, a pair of quotes ""+enter, [one space]+enter. Happy to hear and try some other ideas. Thanks!
Dev (21 rep)
Jul 10, 2021, 04:19 AM • Last activity: Dec 7, 2021, 12:07 PM
Showing page 1 of 20 total questions