Search results for

DTiPhoneSimulatorErrorDomain Code 2

158,470 results found

Post

Replies

Boosts

Views

Activity

SwiftData EXC_BAD_ACCESS(code=2... on construction of ModelContainer
Hi, I'm making this post partly as a bug report, and partly to help others that run into what I just did using SwiftData (and probably happens in CoreData). I have a model I just added in my app that looks kinda like this: @Model final class Reference { // represents a reference to an external web source var project: Project } and I tried adding a relationship to a parent model: @Model final class Project { @Relationship(deleteRule: .cascade, inverse: Reference.project) var references = [Reference]() } I then started getting a crash with EXC_BAD_ACCESS(code=2 on Previews, and running it in simulator/device revealed the crash to be happening on the ModelContainer initialization at the App startup: After hours of searching for a solution, I saw some mention of similar unexplained crashes occurring due to some property names that CoreData doesn't like, but are not documented as such. So I changed the references variable in Project to projectReferences on a hunch (references is a core programmin
1
0
1k
Jan ’24
CryptoTokenKit Code=-2, Failed to get externalisedContext from LAContext.
I am facing an error regarding crypto kit in Touch ID device. I am using secure enclave for storing login credentials using Touch ID.During Touch ID setup and storing the data on secure enclave are working fine but I am getting below error intermittently on iOS 13 while retrieving the data.Error Domain=CryptoTokenKit Code=-2 Failed to get externalisedContext from LAContext.I can't find any answer online. Thanks in advance.P.S.- I am getting this issue only on touch ID (working fine for face ID) devices and on iOS 13.
3
0
1.5k
Jan ’20
Rewrite of Swift Code 2 into version 3
I am trying to rewrite the following code into Swift 3, can anyone Help? self.queryDidUpdateObserver = NSNotificationCenter .defaultCenter() .addObserverForName(NSMetadataQueryDidUpdateNotification, object: metadataQuery, queue: NSOperationQueue.mainQueue()) { (notification) in self.queryUpdated() } self.queryDidFinishGatheringObserver = NSNotificationCenter .defaultCenter() .addObserverForName(NSMetadataQueryDidFinishGatheringNotification, object: metadataQuery, queue: NSOperationQueue.mainQueue()) { (notification) in self.queryUpdated() }
4
0
548
Dec ’16
Thread 1: EXC_BAD_ACCESS (code=2, address=0x16f603ff8)
I'm currently writing a code to achieve the RSA encryption via C++, and I stumbled across this error message when I was running it. The first part of my code is to generate random prime numbers based on the digit from the input for the encryption. For example, if you enter 6 then the code will generate two prime numbers, M and m, between 100000 to 999999. The fin variable equals (M-1)*(m-1), and based on fin I will create an int array the size of [fin+1] in the Random e section. However, if I enter a number greater than 3 ( which means fin will go beyond 6 digits) the crash will occur and the error message will show. I can't seem to find the problem anywhere, and if my input is no greater than 3 then the code will work exactly as I wanted it to. Is there something I missed? Thank you very much. Xcode [14.3.1] #include #include #include using namespace std; long long int gcd(long long int x, long long int y) { for (long long int t; y!=0; x=t) { t=y; y=x%y; } retu
2
0
2.2k
Aug ’23
iOS - SecKeyCreateSignature iOS 13 CryptoTokenKit code = -2
Hi,I am using SecKeyCreateSignature to sign the data. It works for most users but for some iOS 13 users we are getting following error:Error Domain=CryptoTokenKit Code=-2 Failed to get externalizedContext from LAContext UserInfo={NSLocalizedDescription=Failed to get externalizedContext from LAContext}The error is only happening on iOS 13 devices and happens intermittently. I have copied the relevant code below:-(NSData*) signData:(NSString*) textData withAuthenticator:(SANDKSecurityDeviceAuthenticator) auth andUID:(NSString*) userID error:(NSInteger*) errorCode { Authenticator *authenticator = [AuthenticatorManager getAuthenticator:auth]; // Get private key selected for signing NSString *alias = [NSString stringWithFormat:@%@%@, userID,authenticator.type]; SecKeyRef privateKey = (SecKeyRef)[authenticator getPrivateKeyRef:alias]; // Generate digest NSData* dataToSign = [textData dataUsingEncoding:NSUTF8StringEncoding]; NSData* hashedDataToSign = [HashUtils hasData:dataToSign withAlgo
2
0
1.5k
Dec ’19
WeatherKit JWT fails (WDSJWTAuthenticatorServiceListener Code 2) despite entitlement
I’m hitting a WeatherKit JWT failure (WDSJWTAuthenticatorServiceListener Code = 2) at runtime even though the entitlement is present in both the signed binary and the embedded provisioning profile. Environment Team ID 5SZLQLQ9MD Bundle ID ParkProfessor.ParkProfessorDisneyland Device / OS iPhone 15 Pro · iOS 17.4.1 (hardware, not simulator) Xcode 15.3 (15E204a) Console output Failed to generate jwt token for: com.apple.weatherkit.authservice Error Domain=WeatherDaemon.WDSJWTAuthenticatorServiceListener.Errors Code=2 (null) Entitlement & profile snippets codesign -d --entitlements :- WeatherKitTest.app | grep -A2 weatherkit com.apple.developer.weatherkit security cms -D -i embedded.mobileprovision | grep -A2 weatherkit com.apple.developer.weatherkit What I’ve already tried Regenerated a new development certificate and a new iOS App Development provisioning profile with WeatherKit enabled. Confirmed the capability is selected in Certificates ▸ Identifiers ▸ Profiles and ad
4
0
235
May ’25
How to properly refactor repeated code of 2 ViewControllers?
I have 1 UIViewController with a type of CustomTableView and 1 UITableViewController with a type of usual UITableView. Both conform to NSFetchedResultsControllerDelegate and implemented its delegate methods with the repeated code. For now it's in extensions. Is it possible to move that code out to a separate swift file? I tried to move it to separate file with class NSFetchedResultsView, but when I copy that delegate methods to the new file, it doesn't know anything about tableView inside it's methods... How can I separate that methods properly? Delegate methods I want to separate: func controllerWillChangeContent(_ controller: NSFetchedResultsController) { tableView.beginUpdates() } func controllerDidChangeContent(_ controller: NSFetchedResultsController) { tableView.endUpdates() } func controller(_ controller: NSFetchedResultsController, didChange anObject: Any, at indexPath: IndexPath?, for type: NSFetchedResultsChangeType, newIndexPath: IndexPath?) { switch type { case .update: if let in
1
0
473
Jan ’22
Looking for a mentor with ble bluetooth coding swift 2 experience
I'm a newbie to IOS but coming along. I have a single view swift 2 project that I would like to use to connect to an Arduino and send data back and forth.The examples I find on the internet are mostly objective c and too difficult for me to convert. And frankly I think with swift 2 they are a bit out of date.I found one app that sends the changing values of a slider to an Arduino BLE Shield. I have changed the UUID to match the UUID of the Arduino shield but I don't see where they connect as I walk through the code with breakpoints.I am looking for someone who can help me one on one, to get over the hump, with this simple app.
1
0
430
Feb ’16
How to merge two project code in one common project in objective C ?
Hello everyone,Greeting for the day...!!!!I have two different projects, let's say PROJECT 1 and PROJECT 2. In both projects some files (code and design) are common. Now I want to create PROJECT COMMON that should contain common files and make it separate application. And also want to create all three targets (PROJECT 1, PROJECT 2 and PROJECT COMMON) in single application.How can it possible, please help me if anyone have an idea.Thanks.
0
0
573
Aug ’17
WWDC 21 Reality Kit 2 sample code
I'm trying to get familiar with the changes in RealityKit 2. When I try to build the sample app from WWDC I get quite a few compile errors. Anyone have any success getting this to build? https://developer.apple.com/documentation/realitykit/building_an_immersive_experience_with_realitykit
1
0
772
Jun ’21
FamilyControlsError Code=2 on Parent's Device
I have tried to use Screen Time API. The problem is that I can't get access to FamilyControl framework on parent's device. What should I do to get access? class AppDelegate: NSObject, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { AuthorizationCenter.shared.requestAuthorization { res in switch res { case .success(): print(===SUCCESS AUTHORIZATION===) case .failure(let error): print(error.localizedDescription) } } return true } }
1
0
1.2k
Oct ’21
EXC_BAD_ACCESS (code=2, address=0x16d003d98)
class Book: Codable { let name: String var author: Author? init(name: String) { self.name = name } deinit { debugPrint(Deinitialized Book) } } class Author: Codable { let name: String let age: Int weak var book: Book? init(name: String, age: Int) { self.name = name self.age = age } deinit { debugPrint(Deinitialized Author) } } let author = Author(name: Ronit, age: 1) let book = Book(name: Ronit Book) book.author = author author.book = book let encode = try? encoder.encode(author) (Why does this line give EXC_BAD_ACCESS error even though by adding weak we have removed any strong references between objects)
0
0
287
Sep ’23