Post

Replies

Boosts

Views

Activity

Reply to codesigning with 2 user accounts on 1 machine
Which macOS and Xcode versions? Xcode managed certificates are recommended for initial setup which uses the default login keychain (see https://developer.apple.com/forums/thread/709545?answerId=719589022#719589022) Try opening the p12 using the Keychain Access app, which will import to the default login keychain then right click on the certificate > Evaluate "Developer ID Application: Name (Team)" for Code Signing. You can also get info on the certificate to confirm it is valid for code signing by checking the extensions for something like this: Extension Key Usage ( 2.5.29.15 ) Critical YES Usage Digital Signature Extension Basic Constraints ( 2.5.29.19 ) Critical YES Certificate Authority NO Extension Extended Key Usage ( 2.5.29.37 ) Critical YES Purpose #1 Code Signing ( 1.3.6.1.5.5.7.3.3 ) If it is not valid for code signing then export again using Keychain Access.
Jul ’22
Reply to Disable DNS Cache on macOS
Not sure if you can disable the DNS cache without disabling DNS completely. To stop and continue queries try sudo killall -STOP mDNSResponder and sudo killall -CONT mDNSResponder. Also not sure what layers this affects and what they might cache. You can still flush the DNS cache easily using sudo killall -HUP mDNSResponder so repeated calls might appear like a disabled cache. https://support.apple.com/en-us/HT202516 Use dns-sd -q apple.com  to verify this:   dns-sd -Q apple.com DATE: ---Tue 19 Jul 2022--- 15:20:11.663 ...STARTING... Timestamp A/R Flags if Name Type Class Rdata 15:20:11.664 Add 40000002 0 apple.com. Addr IN 17.253.144.10 15:20:14.156 Rmv 0 0 apple.com. Addr IN 17.253.144.10 15:20:14.166 Add 2 0 apple.com. Addr IN 17.253.144.10 Some historical commands are now deprecated with SIP and for security. sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist: Operation not permitted while System Integrity Protection is engaged man mDNSResponder sudo killall -INFO mDNSResponder   Sending SIGINFO to mDNSResponder daemon is deprecated. To trigger state dump, please use 'dns-sd -O', enter 'dns-sd -h' for more information sudo dns-sd -O XPC service returns error, description: State dump is only enabled in internal builds
Topic: App & System Services SubTopic: Core OS Tags:
Jul ’22
Reply to Is it possible for MacOS App to act as web socket server?
thank you I will look at these Network framework is covered in the following WWDC sessions (which I'm rewatching as about to start work on the network server part of an app): Introducing Network.framework: A modern alternative to Sockets: https://developer.apple.com/videos/play/wwdc2018/715/ Advances in Networking, Part 1: https://developer.apple.com/videos/play/wwdc2019/712/ (introduces NWProtocolWebSocket) Advances in Networking, Part 2: https://developer.apple.com/videos/play/wwdc2019/713/ (introduces NWProtocolWebSocket) Boost performance and security with modern networking: https://developer.apple.com/videos/play/wwdc2020/10111 Accelerate networking with HTTP/3 and QUIC: https://developer.apple.com/videos/play/wwdc2021/10094 Build device-to-device interactions with Network Framework: https://developer.apple.com/videos/play/wwdc2022/110339/
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’22
Reply to Xcode 14.0 beta 4 minimum Project iOS Deployment Target is 11.0
https://developer.apple.com/documentation/xcode-release-notes/xcode-14-release-notes (scroll to last Deprecations) Building iOS projects with deployment targets for the armv7, armv7s, and i386 architectures is no longer supported. (92831716) Building for deployment to OS releases older than macOS 10.13, iOS 11, tvOS 11, and watchOS 4 is no longer supported. (92834476)
Jul ’22
Reply to I wonder why operator overriding is like this.
A Swift expert may provide a better answer. + is the builtin standard infix operator equivalent to infix operator +: AdditionPrecedence which you are overriding by extending CGPoint (vs add which is just a plain old static function and cannot be used as an infix operator between two targets). https://developer.apple.com/documentation/swift/operator-declarations You can define your own custom infix operator (with naming restricted to specific characters) like this: (although recommend against this) infix operator ✜: AdditionPrecedence // heavy open centre cross extension CGPoint { static func ✜(lhs: Self, rhs: Self) -> CGPoint { CGPoint(x: lhs.x + rhs.x, y: lhs.y + rhs.y) } } private func testCGPoint() { print(CGPoint(x: 2, y: 3) ✜ CGPoint(x: 4, y: 5)) } https://docs.swift.org/swift-book/LanguageGuide/AdvancedOperators.html#ID46 (Custom Operators) https://docs.swift.org/swift-book/ReferenceManual/LexicalStructure.html#ID418 (Lexical Structure - Operators)
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jul ’22
Reply to Remove comments in the header of a project
Add ~/Library/Developer/Xcode/UserData/IDETemplateMacros.plist with an empty FILEHEADER entry to generate an empty comment. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>FILEHEADER</key> <string></string> </dict> </plist> Xcode help: Customize text macros: https://help.apple.com/xcode/mac/9.0/index.html?localePath=en.lproj#/dev91a7a31fc Text macros reference: https://help.apple.com/xcode/mac/9.0/index.html?localePath=en.lproj#/dev7fe737ce0 If you really want to remove that empty comment line then you will need to start adding custom file templates. eg for a No Comment Swift File template create the following: ~/Library/Developer/Xcode/Templates/File Templates/MultiPlatform/Source/No Comment Swift File.xctemplate/___FILEBASENAME___.swift with import Foundation followed by an empty line ~/Library/Developer/Xcode/Templates/File Templates/MultiPlatform/Source/No Comment Swift File.xctemplate/TemplateInfo.plist with something like: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>SupportsSwiftPackage</key> <true/> <key>Kind</key> <string>Xcode.IDEFoundation.TextSubstitutionFileTemplateKind</string> <key>Description</key> <string>A no comment Swift file.</string> <key>Summary</key> <string>A no comment Swift file</string> <key>SortOrder</key> <string>1</string> <key>Image</key> <dict> <key>FileTypeIcon</key> <string>swift</string> </dict> <key>AllowedTypes</key> <array> <string>public.swift-source</string> </array> <key>Platforms</key> <array/> <key>DefaultCompletionName</key> <string>File</string> <key>MainTemplateFile</key> <string>___FILEBASENAME___.swift</string> </dict> </plist> The default empty Swift File template in the Xcode 14 beta is: /Applications/Xcode-beta.app/Contents/Developer/Library/Xcode/Templates/File Templates/MultiPlatform/Source/Swift File.xctemplate/ (do not edit this directly).
Aug ’22
Reply to Get notified when a new application is installed?
Ideally I'd put this in one of the daemons, so that monitoring won't be a problem. I am not currently using kMDQueryWantsUpdates... but can I? That is, will it keep working forever? MDQueryExecute(query, CFOptionFlags(kMDQueryWantsUpdates.rawValue)) will keep monitoring forever with kMDQueryDidUpdateNotification notifications after the initial kMDQueryProgressNotification and kMDQueryDidFinishNotification notifications. Note: In a command line context you'll probably need a manual RunLoop for the notifications to fire. Might also be worth looking at the higher level NSMetadataQuery with enableUpdates().
Topic: App & System Services SubTopic: General Tags:
Aug ’22
Reply to Get notified when a new application is installed?
Also remember to pause updates with MDQueryDisableUpdates / MDQueryEnableUpdates while iterating over results: https://developer.apple.com/documentation/coreservices/kmdquerywantsupdates https://developer.apple.com/documentation/coreservices/1413041-mdquerydisableupdates https://developer.apple.com/documentation/coreservices/1413066-mdqueryenableupdates
Topic: App & System Services SubTopic: General Tags:
Aug ’22