I am in peril. Can anyone save me. I am desperate!
I am using Xcode Version 14.2 (14C18). I created a fresh new library project (plain C/C++) and added the well-known SQLite3.h and SQLite3.c.
When I build debug configuration, Xcode correctly produces dylib. But when I do archive build, the generated xcarchive is almost empty - it does not have expected libsqlite3s.dylib!
I even went back to Xcode 7.2.1 on macOS 10.10. Xcode 7.2.1 can correctly produce archived dylib and I can link the dylib with a test app.
I am extremely frustrated!
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Xcode 14.2 is really crap.
I cannot find the Preview function as what I have in previous version. I cannot find this menu item:
I have not upgraded to Ventura yet. Yesterday one of my user (of one of my apps) mentioned that he has no Python environment on Ventura. Is it true?
I have not touched Swift code for more than a year. My skills become rusty.
I am not sure what stupid errors I made in the following code:
extension Bundle {
func readResourceFile(_ filename: String) -> String? {
if let fileUrl = self.resourceURL?.appendingPathComponent(filename, isDirectory: false) {
return try? String(contentsOf: fileUrl)
}
return nil
}
}
class MyVC {
//...
@IBAction func testButton_click(_ sender: Any) {
Task.init { await self.test1() }
}
func test1() async {
var loaded = false
do {
let result = try await self.webView.evaluateJavaScript("typeof(jQuery)")
loaded = result as? String == "function"
} catch {
self.statusLabel.stringValue = "error: \(error)"
}
if (loaded) {
await self.runUserScript(self.input.string)
return
}
let scriptFiles = ["jQuery.js", "Scriptlets.js"]
var count = 0
for scriptFile in scriptFiles {
print("Loading \(scriptFile)")
do {
if let script = Bundle.main.readResourceFile(scriptFile) {
try await self.webView.evaluateJavaScript(script)
print("Loaded \(scriptFile)")
count += 1
}
} catch {
self.statusLabel.stringValue = "error: \(error)"
}
}
}
The line if let script = Bundle.main.readResourceFile(scriptFile) { succeeds but script still is nil and causes app crash in next line self.webView.evaluateJavaScript(script).
Bundle.main.readResourceFile(scriptFile) is working if I run this line elsewhere.
EDIT:
When I click on the I button in debugging on variable script I get:
(String) script = <no location, value may have been optimized out>
However, I can print(script) and the output is correct.
This is really disgusting. I really hate to say this.
I started Xcode programming many years ago when it's at version 4 (or even 3). It has been fun and pleasure to program in this IDE, with no problem at all. User rating of this app in App Store was 4.5+.
But 2 or 3 years ago, maybe starting from Xcode 11, it started getting too many quirks/gotchas. App Store user rating drops to 3.5+.
With version 14+, user rating drops to 2.9.
The app's key/main features work. But many small bugs/nuisances put developers like me into peril during daily coding work.
Now I almost want to quit Xcode programming, because it is making my life unpleasant.
I remember last time I could download epub book (5.7) of the Swift language from https://www.swift.org. But now I cannot find the link. Where is the link now?
I am reading "Managing Strings Files Yourself".
Now the question arises in my mind. Is it possible to add new localizations using ibtool (or alike)?
The reason I have this question is that I have a plan to build an app to automate strings localization so that I will be freed from tedious and repetitive work on translation.
A simple question, but I am not able to find the answer myself.
Note - I tried ProcessInfo.environment but it does not include system env vars.
I have the following code:
let obj: LanguageItem? = LanguageItem(language: "zh-CN")
// Argument type 'LanguageItem?' does not conform to expected type 'CVarArg'
print(String(format:"obj: %@", obj))
struct LanguageItem: Codable
{
var language: String
var name: String?
}
How can I make my class work with String(format:)?
The following code compiles fine in a normal Swift app, but not in the accompanying unit test bundle.
I don't have any idea why.
import Foundation
struct Dummy: NSObject { // Error: Inheritance from non-protocol type 'NSObject'
var name: String?
}
I have a simple test project which has a framework bundle (as a target). See attached screenshots.
When I import MyFramework and use classes from the framework, the app compiles fine but got linker errors. It seems Xcode does not automatically link the bundle into the app.
This may sound strange, but I encounter real world need on this.
private var queryItems_: [URLQueryItem]?
private var queryItems: [URLQueryItem]? {
get {
if queryItems_ == nil {
if !queries.isEmpty {
queryItems_ = queries.map { (key: String, value: String?) in
return URLQueryItem(name: key, value: value)
}
}
}
return queryItems_
}
}
/// Query strings
public private(set) lazy var queries = [String: String?]() {
didSet {
queryItems_ = nil
}
}
The queryItems will be (re)created on get if queries property was changed. What I wish is that I could use queryItems as a simple var property but let me do my logic in its getter. Is this supported already?
I have the following code:
public var endpoint: String! {
willSet { if newValue == nil { throw ErrorCode.NullValue("endpoint") } }
}
But compiler gives me error: Error is not handled because the enclosing function is not declared 'throws'
I got a few answers from SO, but the tools are too old and they don't even run my macOS (12.6).
Is there any official way to extract an Assets.car file?
The reason I ask this question is that I want to re-use the icons for strings/storyboard files in Xcode packaged Assets.car (if it's legal).
I want to expand the first only root node when NSOutlineView is finished loading all data.
How to get notified in code (possibly by some delegate function)?