Skip to content

Instantly share code, notes, and snippets.

@adamkaplan
adamkaplan / UserAgent.swift
Created April 30, 2019 17:58
User Agent Strings in Swift
public class UserAgent {
public static let userAgent: String? = {
guard let info = Bundle.main.infoDictionary,
let appNameRaw = info["CFBundleDisplayName"] ?? info[kCFBundleIdentifierKey as String],
let appVersionRaw = info[kCFBundleVersionKey as String],
let appName = appNameRaw as? String,
let appVersion = appVersionRaw as? String
else { return nil }
#if canImport(UIKit)
Do this... ...when you see this message
⌘B Build ...<some long message>. Build again to continue.
⌘⇧K Clean ...received multiple target ended messages for target ID...
⌘⇧K Clean ...targetID (174) not found in _activeTargets...
File > Packages > Resolve Package Versions ...unable to load transferred PIF: The workspace contains multiple references with the same GUID PACKAGE:1YZON8U0E6OSQJJ6SVU...
Close and reopen project (Clean will fail) ...unknown error while handling message: unknownSession(handle: S0)...
Restart Xcode (Clean will fail) ...unknown error while handling message: MsgHandlingError(message: unable to initiate PIF transfer session (operation in progress?))
Restart Xcode Clean failed.
Quit the Simulator and re-run test/s Failed to establish communication with the test runner. (Underlying Error: Simulator indicated unix domain socket for testmanagerd at path [...]/com.apple.testmanagerd.unix-domain.socket, but no file was found at that path.)