iam new to ios swift development
Post
Replies
Boosts
Views
Activity
Hi --
I would like to be able to pass a Swift Array to C++ code. I know it should be possible, but having trouble figuring out the right way to do it. Here is an example class showing what I want to do.
C++ code:
class Foo {
public:
Foo(const std::vector<uint8_t> & values) : _values(values) {}
protected:
std::vector<uint_8> _values;
};
Swift code:
let values: [UInt8] = [ 1, 2, 3, 4, 5, 6 ]
var foo = Foo(values)
If I do this, I get the following error message: Cannot convert value of type '[UInt8]' to expected argument type 'std.__1.vector<UInt8, allocator<UInt8>>'.
I've been asked to update our app from the current metal code to Metal 3, and one of the concerns is whether we have to worry about any changed or deprecated features. Is there a way to confirm that our app won't behave differently now that it's under Metal 3? I am able to compile the iOS app targeting iOS 16, and shaders and pipelines are working as expected, is that proof enough that we are good to go? I don't see any version declarations or import dependencies to specific metal versions (ie. like in openGL where you would declare the shader version with #version 150 or something)...
Hi there,
I’m having issue using Apple’s API. I can’t initialize SFAuthorizationPluginView using Swift.
I’ve done numerous google searches, but haven’t found any examples/tutorials of anyone using Swift for SFAuthorizationPluginView / AuthorizationPluginCreate.
I managed to get the AuthorizationPlugin and AuthorizationMechanism up, but simply creating the SFAuthorizationPluginView fails the failable initiator.
https://developer.apple.com/documentation/securityinterface/sfauthorizationpluginview
Here are some log messages I wrote:
error 16:08:33.689244-0800 kernel Library Validation failed: Rejecting '/Library/Security/SecurityAgentPlugins/XXXAgent.bundle/Contents/MacOS/XXXAgent' (Team ID: 7X6364JT77, platform: no) for process 'SecurityAgentHel(2689)' (Team ID: N/A, platform: yes), reason: mapping process is a platform binary, but mapped file is not
error 16:08:33.689501-0800 SecurityAgentHelper-arm64 Error loading /Library/Security/SecurityAgentPlugins/XXXAgent.bundle/Contents/MacOS/XXXAgent (78): dlopen(/Library/Security/SecurityAgentPlugins/XXXAgent.bundle/Contents/MacOS/XXXAgent, 0x0106): tried: '/Library/Security/SecurityAgentPlugins/XXXAgent.bundle/Contents/MacOS/XXXAgent' (code signature in <BFF0D7BA-5CF8-3F2F-A604-DCC235499234> '/Library/Security/SecurityAgentPlugins/XXXAgent.bundle/Contents/MacOS/XXXAgent' not valid for use in process: mapping process is a platform binary, but mapped file is not), '/System/Volumes/Preboot/Cryptexes/OS/Library/Security/SecurityAgentPlugins/XXXAgent.bundle/Contents/MacOS/XXXAgent' (no such file), '/Library/Security/SecurityAgentPlugins/XXXAgent.bundle/Contents/MacOS/XXXAgent' (code signature in <BFF0D7BA-5CF8-3F2F-A604-DCC235499234> '/Library/Security/SecurityAgentPlugins/XXXAgent.bundle/Contents/MacOS/XXXAgent' not valid for use in process: mapping process is a platform binary, but mapped file is not)
default 16:08:33.760679-0800 SecurityAgentHelper-arm64 callbacks: Optional(0x00000001001b1f88)
default 16:08:33.760710-0800 SecurityAgentHelper-arm64 andEngineRef: Optional(0x0000000156f384d0)
error 16:08:33.762404-0800 SecurityAgentHelper-arm64 Test API call result: OSStatus 0 i.e. No error.
error 16:08:33.763298-0800 SecurityAgentHelper-arm64 Failed to create Authorization Plugin Adapter
default 16:08:33.763524-0800 authd engine 66: running mechanism XXXAgent:XXXAgentMechanism (1 of 1)
Here is the calling code with the error message:
class AuthorizationMechanismXXX : AuthorizationMechanism
{
let mLogger = …
let mAuthorizationPluginView : AuthorizationPluginViewAdapter?
override init(inPlugin: UnsafeMutablePointer<AuthorizationPlugin>,
inEngine: AuthorizationEngineRef,
inMechanismId: AuthorizationMechanismId)
{
…
let pCallbacks : UnsafePointer<AuthorizationCallbacks> = inPlugin.pointee.EngineCallback()
self.mAuthorizationPluginView = AuthorizationPluginViewAdapter(callbacks: pCallbacks, andEngineRef: inEngine)
if (self.mAuthorizationPluginView == nil)
{
mLogger.error("Failed to create Authorization Plugin Adapter")
}
super.init(inPlugin: inPlugin, inEngine: inEngine, inMechanismId: inMechanismId)
}
Here is the class:
class AuthorizationPluginViewAdapter : SFAuthorizationPluginView
{
let mLogger = …
let mLoginView = NSHostingView(rootView: LoginView())
override init!(callbacks: UnsafePointer<AuthorizationCallbacks>!, andEngineRef engineRef: AuthorizationEngineRef!)
{
mLogger.notice("callbacks: \(callbacks.debugDescription, privacy: .public)")
mLogger.notice("andEngineRef: \(engineRef.debugDescription, privacy: .public)")
var sessionId: UnsafeMutablePointer<AuthorizationSessionId?>?
let result = callbacks.pointee.GetSessionId(engineRef, sessionId)
LogSecurityOSStatus(logger: mLogger, osStatus: result, message: "Test API call result")
super.init(callbacks: callbacks, andEngineRef: engineRef)
mLogger.notice("Never gets here")
}
override func buttonPressed(_ inButtonType: SFButtonType)
{
if (inButtonType == SFButtonTypeOK)
{
let osStatus = callbacks().pointee.SetResult(engineRef(), AuthorizationResult.allow)
if (osStatus != errSecSuccess)
{
LogSecurityOSStatus(logger: mLogger, osStatus: osStatus, message: "Error setting authorization result")
}
}
else if (inButtonType == SFButtonTypeCancel)
{
let osStatus = callbacks().pointee.SetResult(engineRef(), AuthorizationResult.deny)
if osStatus != errSecSuccess
{
LogSecurityOSStatus(logger: mLogger, osStatus: osStatus, message: "Error setting authorization result")
}
}
else
{
mLogger.error("Invalid buttonType.")
}
}
override func view(for inType: SFViewType) -> NSView!
{
if (inType == SFViewTypeIdentityAndCredentials)
{
mLogger.debug("Identity and credentials")
}
else if (inType == SFViewTypeCredentials)
{
mLogger.debug("Credentials only")
}
else
{
mLogger.error("Invalid buttonType.")
}
return mLoginView
}
}
Here is the view:
import SwiftUI
struct LoginView: View {
var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
}
}
#Preview {
LoginView()
}
Hello. iOS 15 and its version of Swift had an issue with applying class level annotations, such as @available to the members of its class. When we attempt to use our Objective-C library to get the class, if there are things inside the class not available on iOS 15, then the call to objc_getClass crashes with EXC_BAD_ACCESS. This appears to have been fixed on iOS 16 and newer, however, as we still support iOS 15, is there a better workaround than having to annotate every needed member of the class with @available, instead of being able to use the class level annotation?
I have a demo app to explain how mergeable libraries work and I am stuck when archiving.
I have:
Project Demo
App Target
Framework A
Framework B
External Framework Project C (sub-project to Project Demo)
Framework C
I have all three frameworks in the demo project's dependencies, linking and embedding. Implicitly find dependencies is OFF (because that is how the actual app I will be applying this to is built)
I can build to sim/device for Debug and for Release. It all works. I can find my embedded resources. I have checked the binaries with otool -l and I can see where frameworks are loaded in Debug but not in Release. Yay!
But when I Archive the app, I get an error only for my External framework (not in the same project as the app) that it cannot find the file ExternalC.framework/ExternalC, even though if I copy the path, the file exists.
Build input file cannot be found: '/Users/MYUSER/Library/Developer/Xcode/DerivedData/MergeableLibrariesDemo-afgemdngqmoznfhczuxrqzkeulhb/Build/Intermediates.noindex/ArchiveIntermediates/MergableLibraries/BuildProductsPath/Release-iphoneos/ExternalC.framework/ExternalC'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it? (in target 'MergeableLibrariesDemo' from project
Here are the linker commands for the three frameworks:
-Xlinker -merge_library -Xlinker /Users/MYUSER/Library/Developer/Xcode/DerivedData/MergeableLibrariesDemo-afgemdngqmoznfhczuxrqzkeulhb/Build/Intermediates.noindex/ArchiveIntermediates/MergableLibraries/BuildProductsPath/Release-iphoneos/ExternalC.framework/ExternalC
-Xlinker -merge_framework -Xlinker SameProjectA
-Xlinker -merge_framework -Xlinker SameProjectB
Oh ExternalC.framework is an alias to the framework in the Uninstalled Products path
This is only an issue if ExternalC has this set:
//:configuration = Debug
MERGEABLE_LIBRARY = YES
//:configuration = Release
MERGEABLE_LIBRARY = YES
//:completeSettings = some
MERGEABLE_LIBRARY
Any clues as to what I might have misconfigured?
Steve
I have a MacOS application that has a non-consumable in-app purchase that unlocks an enhanced version of the app (in other words, it's a one-time upgrade purchased inside of the app). The transaction is handled using StoreKit 2 and the app is distributed on the MacOS App Store.
I would like to add an affiliate-like program where certain people can promote my application and receive a percentage of the earnings from users that buy the in-app purchase as a result of their promotion. In order to correctly distribute earnings, I need some way to track that a purchase from a user is linked to a certain affiliate.
Research led me to offer codes but I quickly realised that these are only valid for subscriptions (which my purchase is not), and, besides, it seems they are not supported on MacOS. Another constraint that I have is that my application should not make any external network requests (apart from those to Apple servers, like StoreKit), so I cannot use something like Firebase for a custom offer implementation.
I'm not sure what the best way to achieve this is. One way I thought of is to create one non-consumable in-app purchase/product for each affiliate and use a deep link to associate a user with that product. Then, I'll know which affiliate each user comes from based on the product that was used during the purchase. The only problem with this is that products need to be aded at compile-time so each new affiliate I add would require me to publish a new app version.
I'm wondering whether there's a better way to do this?
Hello, I'm currently facing an issue after adding the HaishinKit framework to my project, and I require immediate assistance. I’ve seen many questions regarding this kind of log but haven’t found any solution that fixes this problem.
My project is extensive, consisting of multiple modules and projects. Specifically, I have a module named TelegramUI where the HaishinKit framework has been successfully added and is functioning correctly. Now, I'm trying to add the same framework to another module called Social. I used Swift Package Manager to add the framework, providing the GitHub link and selecting the same version as in TelegramUI. After successfully building the app, it crashes upon launch, and I received the following log. It's worth noting that when I remove the framework from the Social module, everything works normally again.
dyld[490]: Library not loaded: @rpath/HaishinKit_-79AB4CDABF03AA0A_PackageProduct.framework/HaishinKit_-79AB4CDABF03AA0A_PackageProduct
Referenced from: <68034630-FB0B-34CA-B6E6-45967056914E> /private/var/containers/Bundle/Application/7EF5BCB5-4C9C-4CCA-86E8-C9B3332E7BE4/Roobinet.app/Frameworks/TelegramUI.framework/TelegramUI
Reason: tried: '/usr/lib/swift/HaishinKit_-79AB4CDABF03AA0A_PackageProduct.framework/HaishinKit_-79AB4CDABF03AA0A_PackageProduct' (no such file, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/HaishinKit_-79AB4CDABF03AA0A_PackageProduct.framework/HaishinKit_-79AB4CDABF03AA0A_PackageProduct' (no such file), '/private/var/containers/Bundle/Application/7EF5BCB5-4C9C-4CCA-86E8-C9B3332E7BE4/Roobinet.app/Frameworks/HaishinKit_-79AB4CDABF03AA0A_PackageProduct.framework/HaishinKit_-79AB4CDABF03AA0A_PackageProduct' (no such file), '/private/var/containers/Bundle/Application/7EF5BCB5-4C9C-4CCA-86E8-C9B3332E7BE4/Roobinet.app/Frameworks/TelegramUI.framework/Frameworks/HaishinKit_-79AB4CDABF03AA0A_PackageProduct.framework/HaishinKit_-79AB4CDABF03AA0A_PackageProduct' (no such file), '/usr/lib/swift/HaishinKit_-79AB4CDABF03AA0A_PackageProduct.framework/HaishinKit_-79AB4CDABF03AA0A_PackageProduct' (no such file, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/HaishinKit_-79AB4CDABF03AA0A_PackageProduct.framework/HaishinKit_-79AB4CDABF03AA0A_PackageProduct' (no such file), '/private/var/containers/Bundle/Application/7EF5BCB5-4C9C-4CCA-86E8-C9B3332E7BE4/Roobinet.app/Frameworks/HaishinKit_-79AB4CDABF03AA0A_PackageProduct.framework/HaishinKit_-79AB4CDABF03AA0A_PackageProduct' (no such file), '/usr/lib/swift/HaishinKit_-79AB4CDABF03AA0A_PackageProduct.framework/HaishinKit_-79AB4CDABF03AA0A_PackageProduct' (no such file, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/HaishinKit_-79AB4CDABF03AA0A_PackageProduct.framework/HaishinKit_-79AB4CDABF03AA0A_PackageProduct' (no such file), '/private/var/containers/Bundle/Application/7EF5BCB5-4C9C-4CCA-86E8-C9B3332E7BE4/Roobinet.app/Frameworks/HaishinKit_-79AB4CDABF03AA0A_PackageProduct.framework/HaishinKit_-79AB4CDABF03AA0A_PackageProduct' (no such file)Library not loaded: @rpath/HaishinKit_-79AB4CDABF03AA0A_PackageProduct.framework/HaishinKit_-79AB4CDABF03AA0A_PackageProduct
Referenced from: <88CED3C3-284D-3F63-9AB2-585C5F26E4C0> /private/var/containers/Bundle/Application/7EF5BCB5-4C9C-4CCA-86E8-C9B3332E7BE4/Roobinet.app/Frameworks/SocialUI.framework/SocialUI
Reason: tried: '/usr/lib/swift/HaishinKit_-79AB4CDABF03AA0A_PackageProduct.framework/HaishinKit_-79AB4CDABF03AA0A_PackageProduct' (no such file, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/HaishinKit_-79AB4CDABF03AA0A_PackageProduct.framework/HaishinKit_-79AB4CDABF03AA0A_PackageProduct' (no such file), '/private/var/containers/Bundle/Application/7EF5BCB5-4C9C-4CCA-86E8-C9B3332E7BE4/Roobinet.app/Frameworks/HaishinKit_-79AB4CDABF03AA0A_PackageProduct.framework/HaishinKit_-79AB4CDABF03AA0A_PackageProduct' (no such file), '/private/var/containers/Bundle/Application/7EF5BCB5-4C9C-4CCA-86E8-C9B3332E7BE4/Roobinet.app/Frameworks/SocialUI.framework/Frameworks/HaishinKit_-79AB4CDABF03AA0A_PackageProduct.framework/HaishinKit_-79AB4CDABF03AA0A_PackageProduct' (no such file), '/usr/lib/swift/HaishinKit_-79AB4CDABF03AA0A_PackageProduct.framework/HaishinKit_-79AB4CDABF03AA0A_PackageProduct' (no such file, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/HaishinKit_-79AB4CDABF03AA0A_PackageProduct.framework/HaishinKit_-79AB4CDABF03AA0A_PackageProduct' (no such file), '/private/var/containers/Bundle/Application/7EF5BCB5-4C9C-4CCA-86E8-C9B3332E7BE4/Roobinet.app/Frameworks/HaishinKit_-79AB4CDABF03AA0A_PackageProduct.framework/HaishinKit_-79AB4CDABF03AA0A_PackageProduct' (no such file), '/usr/lib/swift/HaishinKit_-79AB4CDABF03AA0A_PackageProduct.framework/HaishinKit_-79AB4CDABF03AA0A_PackageProduct' (no such file, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/HaishinKit_-79AB4CDABF03AA0A_PackageProduct.framework/HaishinKit_-79AB4CDABF03AA0A_PackageProduct' (no such file), '/private/var/containers/Bundle/Application/7EF5BCB5-4C9C-4CCA-86E8-C9B3332E7BE4/Roobinet.app/Frameworks/HaishinKit_-79AB4CDABF03AA0A_PackageProduct.framework/HaishinKit_-79AB4CDABF03AA0A_PackageProduct' (no such file)
Hi,
How is it possible to check if I have a new mail? Is it possible to do it with ScriptingBridge?
Thank you!
I need to search some informations about some apps on App Store but by searching online I can find any information about APIs to do that. Do they exist?
Hi! I am working on an app for Vision Pro. I would like to create a SideBar in a view that shows different topics, that you can click on. Firstly, I need help understanding how to create a SideBar. Also, I have already made the different topics that will be displayed on the SideBar but I don't know how to link the SideBar up to the topics view. For example, if a user clicks on Maple Trees as a topic in the SideBar, it would take them to a new window that talks about Maple Trees.
If you can help, that would be great!
Hello,
I'm developing an app for Mac, Xcode 15.1, with Swift 5.
I need to create a visual matrix, whose elements will be filled randomly, according to the choices the user makes.
The matrix must have 10 columns and 40 rows.
Does anyone know a component, or how to fill it dynamically and randomly?
Thanks.
I have used this example to create the following code:
import Foundation
import CoreLocation
let monitorName = "BeaconMonitor"
let testBeaconId = UUID(uuidString: "EDFA3FFA-D80A-4C23-9104-11B5B0B8E8F3")!
@MainActor
public class ObservableMonitorModel: ObservableObject {
private let manager: CLLocationManager
public var monitor: CLMonitor?
init() {
self.manager = CLLocationManager()
self.manager.requestWhenInUseAuthorization()
self.manager.requestAlwaysAuthorization()
}
func startMonitoringConditions() {
Task {
monitor = await CLMonitor(monitorName)
await monitor!.add(getBeaconIdentityCondition(), identifier: "Beacon")
for identifier in await monitor!.identifiers {
guard let lastEvent = await monitor!.record(for: identifier)?.lastEvent else { continue }
print(identifier, lastEvent.state)
}
for try await event in await monitor!.events {
print("Event", event.identifier, event)
}
}
}
}
func getBeaconIdentityCondition() -> CLMonitor.BeaconIdentityCondition {
CLMonitor.BeaconIdentityCondition(uuid: testBeaconId)
}
Unfortunately, running this on my iPhone only prints "Beacon CLMonitoringState". I don't see anything from the for try await block starting with "Event".
Any ideas where I've gone wrong?
Context: I am trying to create a XCFramework that I can reuse it in my Swift app. My example is based on SPM (Swift Package Manager) but I had the same import error no such module when I tried to import my XCFramework in XCode.
Here is the code for XCFramework:
Package.swift
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "MySDK",
platforms: [.macOS(.v14), .iOS(.v13), .watchOS(.v6)],
products: [
.library(name: "MySDK", type: .dynamic, targets: ["MySDK"]),
],
targets: [
.target(name: "MySDK")
]
)
Sources/MySDK/my_sdk.swift
public func myHelloStr() -> String {
return "Bonjour le monde!"
}
To generate the XCFramework:
$ xcodebuild build -scheme MySDK -destination "platform=macOS" -derivedDataPath DerivedData SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES
$ xcodebuild -create-xcframework -framework DerivedData/Build/Products/Debug/PackageFrameworks/MySDK.framework -output MyFramework.xcframework
I can see MyFramework.xcframework folder with
- `Info.plist`
- `macos-x86_64/MySDK.framework/MySDK`
- `macos-x86_64/MySDK.framework/Resources/Info.plist`
- `macos-x86_64/MySDK.framework/Versions/A/MySDK`
- `macos-x86_64/MySDK.framework/Versions/A/Resources/Info.plist`
- `macos-x86_64/MySDK.framework/Versions/Current/MySDK`
- `macos-x86_64/MySDK.framework/Versions/Current/Resources/Info.plist`
Then I create a new SPM project MyApp
with Package.swift
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "TestApp",
platforms: [.macOS(.v14), .iOS(.v13), .watchOS(.v6)],
products: [
.executable(name: "MyApp", targets: ["MyApp"])
],
targets: [
.executableTarget(name: "MyApp",
dependencies: [
.target(name: "MyFramework")
]
),
.binaryTarget(
name: "MyFramework",
path: "../test_sdk/MyFramework.xcframework"
)
]
)
And Sources/MyApp/main.swift:
import MySDK
print("Hello World: \(myHelloStr())")
$ swift run
Building for debugging...
error: emit-module command failed with exit code 1 (use -v to see invocation)
/Users/olivier/dev/test_app/Sources/MyApp/main.swift:1:8: error: no such module 'MySDK'
import MySDK
^
/Users/olivier/dev/test_app/Sources/MyApp/main.swift:1:8: error: no such module 'MySDK'
import MySDK
^
error: fatalError
If I generate my XCFramework using xcodebuild archive instead of xcodebuild build such as described in this doc https://developer.apple.com/documentation/xcode/creating-a-multi-platform-binary-framework-bundle:
$ xcodebuild archive -scheme MySDK -destination "platform=macOS" -derivedDataPath DerivedData -archivePath "archives/MyFramework" SKIP_INSTALL=NO BUILD_LIBRARY_FOR_DISTRIBUTION=YES
(...)
** ARCHIVE SUCCEEDED **
$ xcodebuild -create-xcframework -archive archives/MyFramework.xcarchive -framework MySDK.framework -output MyFramework.xcframework
error: the path does not point to a valid framework: /Users/olivier/dev/test_sdk/archives/MyFramework.xcarchive/Products/Library/Frameworks/MySDK.framework
... it's not normal because I have these paths in /Users/olivier/dev/test_sdk/archives/MyFramework.xcarchive/Products:
/Users/olivier/dev/test_sdk/archives/MyFramework.xcarchive/Products/Users/olivier/Objects/MySDK.o
/Users/olivier/dev/test_sdk/archives/MyFramework.xcarchive/Products/usr/local/lib/MySDK.framework/...
XCode version
$ xcodebuild -version
Xcode 15.2
Build version 15C500b
The application often crashes and I register an error in the log, see attachment, but I can't figure out where the problem might be.
Eureka.Section.subscript.getter (Swift.Int) Eureka.BaseRow.txt
Thank you very much for the advice
Wondering if anyone else is running into this.
It seems ModelConfiguration(isStoredInMemoryOnly: true) for previews (as outlined by Paul Hudson / Hacking with Swift) works correctly for
iOS + iCloud syncing
macOS WITHOUT iCloud syncing
But as soon as I turn on iCloud syncing capability for my macOS target, its as if the isStoredInMemoryOnly has no effect on the macOS target.
Here's my code...
I made a PreviewHelper to encapsulate the preview logic...
enum PreviewHelper {
static let previewModelContainer: ModelContainer = {
do {
let config = ModelConfiguration(isStoredInMemoryOnly: true)
let container = try ModelContainer(for: Task.self, configurations: config)
return container
} catch {
fatalError("Failed to create model container for previewing: \(error.localizedDescription)")
}
}()
}
And then use it like so...
#Preview {
let container = PreviewHelper.previewModelContainer
for task in MockData.tasks {
container.mainContext.insert(task)
}
return HorizonView()
.modelContainer(container)
}
On the macOS target & destination, using a macOS device in the Preview canvas, with iCloud syncing turned on that code inserts the MockData.tasks into my iCloud container every time the preview refreshes, so the data just keeps getting duplicated. With iCloud syncing turned off it behaves as expected/correctly (just inserting the MockData as needed for Previews).
In an iOS target, using the same helper and mock data, the helper behaves as expected/correctly (with or without iCloud syncing enabled).
Assuming this might be a bug/oversight with SwiftData and macOS? Or am I missing a needed configuration/capability on the macOS side? Anybody else seeing this?
hello
We are currently developing using Healthkit.
Starting with xcode15, healthkit throws an error.
The code causing the error is HKQuantityType(.stepCount).
When I use this code
An EXC_BAD_ACCESS (code=1, address=0x0) error occurs.
The error is:
AppDelegate
It also appears when I call didFinishLaunchingWithOptions.
Is the linker the problem?
Or is the Swift version the problem?
Or HealthKit?
Cleaning and initializing DerivedData
I also tried downgrading DriverKit 22.4, but the error still appears.
Please tell me how to solve this problem.
Test model information is as follows:
-iPhone 14 Pro
iOS 16.5.1
Hi,
Just a quick one. I am working with a client who doesn't share his team's credentials like certificates, mobile provisioning, etc. He even refused to add me as one of the developer in his Apple Dev account. So, I am creating a new scheme for me that will use my own personal team and app ID to build it. While the main app's original scheme is basically unusable since I don't have the credentials to build it. The client still needs it for his CI/CD though.
Now, the app has a Notification Service extension that will share UserDefaults via App Group. When I try to create a container with the same group ID as his, it always failed. It seems like we can't use it because it has already been taken by the clent. How do I fix this so I can just change the scheme to switch between the client's and mine?
Thanks.
How to disable iOS Shortcut ( Automation ) Programmatically ?
I have made an automation to open my app whenever a user opens Facebook app. When the user taps on "Continue with Facebook" the automation which is forcing to open my App show be disabled for 2 minutes. How can I achieve this?
I have some Swift classes in my project that extend an Objective-C base class, which in turn extends NSObject. I did this years ago when Swift was new in order to take advantage of some Objective-C code that was difficult to rewrite in Swift. It's not a common situation but it has been working fine for a long time.
One of these classes is used as the key to a Dictionary and thus needs to be Hashable. The way I did this was to implement an == function and override the 'hash' property. It is a very simple case where the identity of the object is based on a single integer:
static func == (lhs: FishModel, rhs: FishModel) -> Bool {
return lhs.fishId == rhs.fishId
}
override var hash: Int {
return fishId
}
I believe that I initially tried to add "Hashable" to the class definition but was told it was redundant. I'm not sure why that is, but it worked fine without it.
Today I took the latest Xcode update to 15.2, and now my project won't compile anymore. The compiler error says that my class "does not conform to protocol Hashable". Adding Hashable to the class definition did not fix it. There are also some unusual errors about missing files, such as abi.json, swiftdoc, swiftmodule, and swiftsourceinfo.
Was this caused by the Xcode update? How do I fix it?