Objective-C Runtime

RSS for tag

The Objective-C runtime is a runtime library that supports the dynamic properties of the Objective-C language.

Posts under Objective-C Runtime tag

88 Posts

Post

Replies

Boosts

Views

Activity

How to define typedef struct in c++ dylib in swift
Say I have an example struct in C++ that is inside dylib like this typedef struct { int a; } addingTemp; and I need to use it for a function that adds 2 together, and store it into 3rd value void add(addingTemp a, addingTemp b, addingTemp& c) { c.a = a.a + b.a; } how do I create the struct in swift? this is my adding library function in swift typealias add = @convention(c) (addingTemp, addingTemp, UnsafeMutablePointer<addingTemp>) -> Void func addLib(a : addingTemp, b: addingTemp, out: inout addingTemp) -> Void{ guard dylib != nil else { errorDylib() return } guard let sym = dlsym(dylib, "add") else { errorDylib() return } let f = unsafeBitCast(sym, to:add.self ) let result : Void = f(a ,b, &out) // closeDylib() return } this is my current implementation public class addingTemp: NSObject { public var a : CInt init(a: CInt = 0) { self.a = a } } but it gives me memory access error, it looks like it isn't being stored properly as the type doesn't match. DLL_PUBLIC void add( addingTemp a, addingTemp b, addingTemp* c,); the function works when I only use Int instead of addingTemp class. Also, when the C++ function is calculating, instead of a.a = 1, b.a = 1, it outputs large numbers such as a.a = 389179664 b.a = 389179344
1
0
1.9k
Nov ’22
Typecasting doesn't work in XCode Version 14.0 (14A309) on MacOS Ventura (13.0 Beta 22A5358e)
I'm working on one of our apps where we have custom NSView class called VLTutorialView. This class has been used as type for contentView of one of the windows. It's been set in both UI as well as the outlet specifies the class as VLTutorialView. However, even after the typecasting as shown as in the screenshot, the class of contentView is NSView and not the required VLTutorialView. Has this issue been observed previously? Any insight would be helpful, and open for queries.
1
0
1.2k
Oct ’22
Crash when trying to reload plugin in runtime with Bundle
I've been playing with runtime plugins reloading using Bundles in Swift. And I've encountered internal crash in conformsToProtocol call while using decoders (JsonDecoder, PlistDecoder etc). This only happens when call PlistDecoder.decode then reload plugin using Bundle.unload, cleanup bundle, load with Bundle.load and call decode in new plugin instance again. As I understand this related to the Swift and Objective-C runtime and the way Bundles/Frameworks are loaded. This doesn't happen if I use NSDictionary to parse plist or json because it doesn't use any runtime magic. Does Swift supports this kind of reloading and if not why is that even possible in this case? Looks more like a bug to me. Also is there a way to reload plugins in runtime without restarting an application? Here's code snippets from my test application Plugin Interface: @objc(PluginInterface) protocol PluginInterface {     init()     func printVersion() } Plugin: struct InfoPlist : Codable {     let CFBundleShortVersionString: String } class Plugin : PluginInterface {     required init() {}     func printVersion() {         print("Current version: \(getVersionFromPlistFile() ?? "nil")")     }     private func getVersionFromPlistFile() -> String? {         let infoPlistPath = Bundle.main.bundlePath + "/Contents/Info.plist"         guard let data = try? Data(contentsOf: URL(fileURLWithPath: infoPlistPath)) else {             return nil         }         let plistData = try? PropertyListDecoder().decode(InfoPlist.self, from: data)         return plistData?.CFBundleShortVersionString     } } Plugin loader: class PluginLoader {     private var pluginBundle: Bundle?     deinit {         unloadDynamicBundle()     }     func load(bundleUrl: URL) -> PluginInterface? {         return loadDynamicBundle(bundleUrl: bundleUrl)     }     func unload() {         unloadDynamicBundle()     }     private func loadDynamicBundle(bundleUrl: URL) -> PluginInterface? {         guard let pluginBundle = Bundle(url: bundleUrl) else {             return nil         }         self.pluginBundle = pluginBundle         do {             try pluginBundle.loadAndReturnError()         } catch {             print("Loading error: \(error.localizedDescription)")             return nil         }         let typeNamed: AnyClass? = pluginBundle.classNamed("Plugin.Plugin")         guard let plugin = initPlugin(from: typeNamed as? PluginInterface.Type) else {             return nil         }         return plugin     }     private func unloadDynamicBundle() {         guard let pluginBundle = pluginBundle else {             return         }         if !pluginBundle.unload() {             return         }         self.pluginBundle = nil     }     private func initPlugin(from type: PluginInterface.Type?) -> PluginInterface? {         if let cls = type {             let plugin = cls.init()             return plugin         }         return nil     } } Here's crash stack trace: Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x000000008dc005f0 Exception Codes: 0x0000000000000001, 0x000000008dc005f0 Exception Note: EXC_CORPSE_NOTIFY Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11 Thread 1 Crashed:: Dispatch queue: com.apple.root.default-qos 0 libswiftCore.dylib 0x7ff8239aa710 swift_conformsToProtocolMaybeInstantiateSuperclasses(swift::TargetMetadata<swift::InProcess> const*, swift::TargetProtocolDescriptor<swift::InProcess> const*, bool) + 2464 1 libswiftCore.dylib 0x7ff8239a9b4e swift_conformsToProtocol + 78 2 libswiftCore.dylib 0x7ff823968fed swift::_conformsToProtocol(swift::OpaqueValue const*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetProtocolDescriptorRef<swift::InProcess>, swift::TargetWitnessTable<swift::InProcess> const**) + 45 3 libswiftCore.dylib 0x7ff8239a91a5 swift::_checkGenericRequirements(__swift::__runtime::llvm::ArrayRef<swift::TargetGenericRequirementDescriptor<swift::InProcess> >, __swift::__runtime::llvm::SmallVectorImpl<void const*>&, std::__1::function<swift::TargetMetadata<swift::InProcess> const* (unsigned int, unsigned int)>, std::__1::function<swift::TargetWitnessTable<swift::InProcess> const* (swift::TargetMetadata<swift::InProcess> const*, unsigned int)>) + 1813 4 libswiftCore.dylib 0x7ff8239a3e19 _gatherGenericParameters(swift::TargetContextDescriptor<swift::InProcess> const*, __swift::__runtime::llvm::ArrayRef<swift::TargetMetadata<swift::InProcess> const*>, swift::TargetMetadata<swift::InProcess> const*, __swift::__runtime::llvm::SmallVectorImpl<unsigned int>&, __swift::__runtime::llvm::SmallVectorImpl<void const*>&, swift::Demangle::__runtime::Demangler&) + 1033 5 libswiftCore.dylib 0x7ff8239a2b03 (anonymous namespace)::DecodedMetadataBuilder::createBoundGenericType(swift::TargetContextDescriptor<swift::InProcess> const*, __swift::__runtime::llvm::ArrayRef<swift::TargetMetadata<swift::InProcess> const*>, swift::TargetMetadata<swift::InProcess> const*) const + 131 6 libswiftCore.dylib 0x7ff8239a119b swift::Demangle::__runtime::TypeDecoder<(anonymous namespace)::DecodedMetadataBuilder>::decodeMangledType(swift::Demangle::__runtime::Node*, unsigned int, bool) + 21499 7 libswiftCore.dylib 0x7ff82399b29d swift_getTypeByMangledNodeImpl(swift::MetadataRequest, swift::Demangle::__runtime::Demangler&, swift::Demangle::__runtime::Node*, void const* const*, std::__1::function<swift::TargetMetadata<swift::InProcess> const* (unsigned int, unsigned int)>, std::__1::function<swift::TargetWitnessTable<swift::InProcess> const* (swift::TargetMetadata<swift::InProcess> const*, unsigned int)>) + 493 8 libswiftCore.dylib 0x7ff82399b06d swift_getTypeByMangledNode + 477 9 libswiftCore.dylib 0x7ff82399b78a swift_getTypeByMangledNameImpl(swift::MetadataRequest, __swift::__runtime::llvm::StringRef, void const* const*, std::__1::function<swift::TargetMetadata<swift::InProcess> const* (unsigned int, unsigned int)>, std::__1::function<swift::TargetWitnessTable<swift::InProcess> const* (swift::TargetMetadata<swift::InProcess> const*, unsigned int)>) + 1002 10 libswiftCore.dylib 0x7ff823998cbd swift_getTypeByMangledName + 477 11 libswiftCore.dylib 0x7ff823998eeb swift_getTypeByMangledNameInContext + 171 12 Plugin 0x10bc74cf9 __swift_instantiateConcreteTypeFromMangledName + 89 13 Plugin 0x10bc75033 protocol witness for Decodable.init(from:) in conformance InfoPlist + 19 14 libswiftCore.dylib 0x7ff82393a5e7 dispatch thunk of Decodable.init(from:) + 7 15 libswiftFoundation.dylib 0x7ff827a61cd8 __PlistDecoder.unbox<A>(_:as:) + 328
1
0
1.3k
Aug ’22
After upgrade Xcode 13,run playground occur a error。
objc[2247]: Class _PathPoint is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore (0x11a0e8a78) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/TextInputUI.framework/TextInputUI (0x130fb08b0). One of the two will be used. Which one is undefined. objc[2247]: Class _PointQueue is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore (0x11a0e8a50) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/TextInputUI.framework/TextInputUI (0x130fb08d8). One of the two will be used. Which one is undefined.
6
0
8.0k
Aug ’22
Use of XCFramwork for iOS causes a message error when uploading a build
I use this package in my app:  https://github.com/liamnichols/_InternalSwiftSyntaxParser  which contains an xcframework: _InternalSwiftSyntaxParser.xcframework which contains dylib files All is good with this package, my app works well in simulator and real device. But when I uploaded a version to the App Store Connect, I got this error message: ITMS-90426: Invalid Swift Support - The SwiftSupport folder is missing. Rebuild your app using the current public (GM) version of Xcode and resubmit it. Is there a solution for that? I searched a lot with out any chance to solve it. What I tried: (1) I tried to add manually the SwiftSupport folder using the script here: https://gist.github.com/adamzarn/6bb89d91ed4b8c3d3fb25363c221441f (2) Then the error message is now: ITMS-90430: Invalid Swift Support - The file lib_InternalSwiftSyntaxParser.dylib doesn’t have a signing ID. Sign the file, rebuild your app using the current public (GM) version of Xcode, and resubmit it. (3) Trying to signing the file using: codesign --force --timestamp --sign <name of certificate> <binary you want to sign> But I always get the same error message in (2)
0
0
1.4k
Aug ’22
Why does modern Xcode generate projects with UIApplicationMain outside of autorelease pool?
If I remember correctly, back in the days Xcode used to generate the main function something like this (at least for iOS applications): int main(int argc, char * argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]); } } I.e. UIApplicationMain function was wrapped inside of @autoreleasepool. However I noticed that currently Xcode no longer does that: int main(int argc, char * argv[]) { NSString * appDelegateClassName; @autoreleasepool { // Setup code that might create autoreleased objects goes here. appDelegateClassName = NSStringFromClass([AppDelegate class]); } return UIApplicationMain(argc, argv, nil, appDelegateClassName); } So, UIApplicationMain is outside of the autorelease pool by default nowadays. Is there any official changelog/paper that explains why the latter implementation is now preferred over the former one?
1
1
1.5k
Aug ’22
Extend ObjC class with Swift extension Causes crashes when released to Appstore
Hi I have an objective project and when I'm extending the project to Swift It works fine when locally testing it and also when testing it over testflight. But after submitting the app to the appstore and when users download it and use I see crash reports coming from the Sentry related with the swift extensions created over the objective-c class. I'm unable to reproduce this locally. Any Help would be appreciated. Attached the crash report. 605534285f8e4c96af32cf25bb283439-symbolicated.crash
2
0
1.4k
Jun ’22
Obfuscate Static Library directly
Hi, I have an application Unity that uses the iOS static library. Then this application Unity is build in XCode. I found several utilities that allow you to obfuscate the library in the application. for example this -PPiOS-Rename. I carefully read their documentation "Obfuscate Static Libraries", but at the time of building, the iOS static library are already "hidden in the root" of the Unity app, and XCode cannot obfuscate this. so I need to first obfuscate the library and then add it to the application. Maybe you can suggest another tool(or workaround)? I'll be very grateful.
0
0
948
Jun ’22
App with CoreNFC.framework crashes on iOS 12.5 with Xcode 13.3.1
I'm developing an app using CoreNFC but it crashes when running on iPhone 6 with iOS 12.5 . Trying to search for an answer I didn't find any solution. When launching the app, this is the error I read in the console: dyld: Library not loaded: /System/Library/Frameworks/CoreNFC.framework/CoreNFC Referenced from: /var/containers/Bundle/Application/327CB0C3-4B7F-4B72-8F70-EEE985F688CD/myAppName.app/myAppName Reason: image not found I've already added CoreNFC.Framework in Targets -> General -> Frameworks, Libraries, and Embedded Content and set it to "Do Not Embed" but it doesn't work. Is there any solution for this? Or is it a bug of Xcode? Please help. Thanks
1
0
2.4k
May ’22
Installing app from the App Store, app is automatically launched into the background
We have noticed recently that when our app is installed from the App Store, it is automatically launched into the background. After the App Store installs our app, it is started into the background (no UI) without the user pressing ‘Open’ from the App Store or tapping the app icon in the home screen. Testing with iOS 15. I assume this is not the correct behavior, an app automatically being launched after being installed. I submitted a bug report (FB9971657), but wanted to know if anyone else was seeing this behavior.
2
0
2.1k
Apr ’22
EXC_GUARD crash (guarded with 0x08fd4dbfade2dead)
Hi everyone, How should I find the root cause of this type of crash with 0x08fd4dbfade2dead? Some file descriptor which is protected but my code closed it, is it correct? But Here's the crash log and from top is close + 8, stack num.1 is a CFRelease(a) function, we do check if a is null before call CFRelease on it. And the for next a few lines are (number 2-6), we don't see any of those function calls open or close a file, no socket network call at all. No sqlite, coredata or even dup and etc... Is there a memory management issue which makes the a point to somewhere else which is the file descriptor?
1
0
1.5k
Mar ’22
The metal-cpp wrapper causes a segfault when calling renderCommandEncoderWithDescriptor:
The metal-cpp wrapper released end of last year wraps the Metal 2 API, and by extension the basic NS foundation, in C++ code. From looking through the code, metal-cpp uses the objc/runtime.h header and uses objc_msgSend and sel_registerName to fetch pointers and call methods as if it were Objective-C code. This mostly works, however I've come across an issue where the renderCommandEncoderWithDescriptor: selector fails to load through sel_registerName. My application creates the default metal device, a command queue, a CAMetalLayer and I can present the drawable through a command buffer and all of it works. However, if I want to start actually rasterising any geometry, I need a MTLRenderCommandEncoder. To create one, I need to call renderCommandEncoderWithDescriptor: on a MTLCommandBuffer, which causes a segfault because the selector is 0x0 and the Objective-C runtime code tries to read from it. This short snippet is where the segfault occurs. Calling MTL::CommandBuffer::renderCommandEncoder will call the objc_msgSend with a 0x0 selector. auto buffer = queue->commandBuffer(); auto encoder = buffer->renderCommandEncoder(renderPass); MTLCommandBuffer buffer = [queue commandBuffer]; MTLRenderCommandEncoder encoder = [buffer renderCommmandEncoderWithDescriptor:renderPass]; And this would be the equivalent in raw Objective-C code, which does in fact work. I have uploaded a small test example to GitHub: https://github.com/spnda/metal-cpp-bug. This example uses GLFW to create the window and I use a small Objective-C++ file to modify the NSWindow and CAMetalLayer, as the metal-cpp wrapper curiously does not provide wrappers for these classes. I am personally on macOS Monterey 12.3 with a M1 iMac 24", it would be interesting to see if this is an issue with everybody, or just specific to my setup. Not being able to create a MTL::RenderCommandEncoder makes Apple's official Metal C++ wrappers absolutely useless for any rendering, and I would much appreciate any help to fix this issue.
1
0
1.6k
Mar ’22
Are bigSur .dylib libraries hidden under vecLib.framework?
I understand what the *.tbd files are doing however what I don't understand is why when I look at the install-name: key there is a path for the actual *.dylib library however I cannot see these, they don't exist with ls. For example below is the head of the MacOSX11.3.sdk/usr/lib/libblas.tbd yaml file: --- !tapi-tbd tbd-version: 4 targets: [ x86_64-macos, x86_64-maccatalyst, x86_64h-macos, x86_64h-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] uuids: - target: x86_64-macos value: 86F0C2E1-6A2D-34E8-AA84-D4224BB49B33 - target: x86_64-maccatalyst value: 86F0C2E1-6A2D-34E8-AA84-D4224BB49B33 - target: x86_64h-macos value: 8151F97D-CE36-3B38-AEF0-AAC55E9F537B - target: x86_64h-maccatalyst value: 8151F97D-CE36-3B38-AEF0-AAC55E9F537B - target: arm64-macos value: 00000000-0000-0000-0000-000000000000 - target: arm64-maccatalyst value: 00000000-0000-0000-0000-000000000000 - target: arm64e-macos value: 46295B04-B6A4-36A1-A4F7-C9B606CF75A5 - target: arm64e-maccatalyst value: 46295B04-B6A4-36A1-A4F7-C9B606CF75A5 install-name: '/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib' exports: - targets: [ arm64e-macos, x86_64-macos, x86_64h-macos, x86_64-maccatalyst, It says the install-name is /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib But I cannot see this file and I am afraid neither can the projects I am trying to compile with cmake/make. $ ls /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib ls: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib: No such file or directory
2
0
2.3k
Mar ’22
objc_copyClassList() not enumerable?
This is a derivative of this and this. On iOS 15(.3.1), if I just try to fetch and enumerate the classes of the objc runtime, waiting until viewDidAppear() to make sure there wasn't some initialization issue: var count = UInt32(0) var classList = objc_copyClassList(&count)! print("COUNT \(count)") print("CLASS LIST \(classList)") for i in 0..<Int(count) { print("\(i)") classList[i] } produces the following before a Thread 1: EXC_BREAKPOINT (code=1, subcode=0x1820e0cdc) COUNT 28353 CLASS LIST 0x000000010bf24000 0 1 2 2022-02-17 16:24:02.977904-0800 TWiG V[2504:705046] *** NSForwarding: warning: object 0x1dbd32148 of class '__NSGenericDeallocHandler' does not implement methodSignatureForSelector: -- trouble ahead 2022-02-17 16:24:02.978001-0800 TWiG V[2504:705046] *** NSForwarding: warning: object 0x1dbd32148 of class '__NSGenericDeallocHandler' does not implement doesNotRecognizeSelector: -- abort I don't know how to do any less with it than just fetching the value. I'm not trying to print it or anything, and yet it still fails. Is there some magic I'm missing? Why have the API if the results crash your program? If the issue is legit, it would be nice of the docs pointed out a workaround, or at least the proper way to cope with the result. (I do not have hardened runtime turned on, XCode 13.2.1)
3
0
1.3k
Feb ’22
[Objective-C] Proper way of calling an overrided base interface method while using a category
Hi, For some of my use cases, I'm extending an interface using a category. I am overriding some of the methods in the base Interface, but want to call the base interface method after I'm done with the workflow inside the category method. Essentially, doing something similar to a "super" call. While I was looking into how to achieve this, have found something called Method Swizzling( https://nshipster.com/method-swizzling/ , https://newrelic.com/blog/best-practices/right-way-to-swizzle), but this looks too 'hacky'. Is there a better way to achieve this?
4
0
1.4k
Jan ’22
How to deduce from NSMethodSignature that a struct argument is passed by pointer?
How to deduce from NSMethodSignature that a struct argument is passed by pointer? Specifically on ARM. For example if I have: @protocol TestProtocol <NSObject> - (void)time:(CMTime)time; - (void)rect:(CGRect)point; @end And then I do: struct objc_method_description methodDescription1 = protocol_getMethodDescription(@protocol(TestProtocol), @selector(time:), YES, YES); struct objc_method_description methodDescription2 = protocol_getMethodDescription(@protocol(TestProtocol), @selector(rect:), YES, YES); NSMethodSignature *sig1 = [NSMethodSignature signatureWithObjCTypes:methodDescription1.types]; NSMethodSignature *sig2 = [NSMethodSignature signatureWithObjCTypes:methodDescription2.types]; const char *arg1 = [sig1 getArgumentTypeAtIndex:2]; const char *arg2 = [sig2 getArgumentTypeAtIndex:2]; NSLog(@"%s %s", methodDescription1.types, arg1); NSLog(@"%s %s", methodDescription2.types, arg2); The output is: v40@0:8{?=qiIq}16 {?=qiIq} v48@0:8{CGRect={CGPoint=dd}{CGSize=dd}}16 {CGRect={CGPoint=dd}{CGSize=dd}} Both look similar, no indication that CMTime will be actually passed as a pointer. But when I print the debug description: NSLog(@"%@", [sig1 debugDescription]); NSLog(@"%@", [sig2 debugDescription]); The first prints: ... argument 2: -------- -------- -------- -------- type encoding (^) '^{?=qiIq}' flags {isPointer} ... While the second prints: ... argument 2: -------- -------- -------- -------- type encoding ({) '{CGRect={CGPoint=dd}{CGSize=dd}}' flags {isStruct} ... So this information is indeed stored in the method signature, but how do I retrieve it without parsing the debug description? Are there rules I can use to deduce this myself? I tried to experiment with different structs but it is hard to spot a pattern.
3
0
1.5k
Jan ’22
App crash with NSInvalidArgumentException
we got the following crash from one of our customers: crash log this is happening once they initialize our SDK, with the following command: public static func initialize() { SDKManager.shared().setup(AppKey) } the shared() call doesn't seem to have the crash error since it uses a dispatch_once which in that case would have been displayed in the crash log. the setup method is just a facade method that calls another method which acts as facade as well. after this, in the 3rd method there is bunch of things happening. the issue is that if we look into the crash log, we see only 2 calls to the SDK framework, which like i said are only 2 facades. - (void)setup:(NSString *)appKey {   [self initSDK:appKey]; } - (void)initSDK:(NSString *)appKey {   [self initSDK:appKey withParams:nil]; } its also not clear, what does the mention of objc-runtime-new.mm have to do with this crash since the SDK does not import or access any runtime objects. also, unfortunately we do not have a valid dsym to decrypt the 2 calls pointing to the SDK.
0
0
905
Dec ’21
Error in Xcode 13.1 when running the app in device
Hi. I am working on Xcode 13.1 When I am building my code and running it on my iPhone (Not on the simulator), the code is crashing. Below is the error message. Please help me out anyone..... *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSBundle initWithURL:]: nil URL argument' *** First throw call stack: (0x1827e9cac 0x199858758 0x183f3c0e0 0x183f12d64 0x103288590 0x1032884b4 0x103288d30 0x102d87544 0x102d86000 0x184c59804 0x184c5c178 0x184d57360 0x184d53a04 0x184f6c928 0x184e4be78 0x184d7a73c 0x1dc3649d4 0x184c3ab28 0x1862a4c4c 0x186297d40 0x1862ab4a4 0x1862b408c 0x184c14b50 0x182795f34 0x182767578 0x182762b0c 0x182775d8c 0x19c8829a0 0x184faafa8 0x184d3f22c 0x102d5bbb0 0x104288190) libc++abi: terminating with uncaught exception of type NSException dyld4 config: DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSBundle initWithURL:]: nil URL argument' terminating with uncaught exception of type NSException
1
0
1k
Dec ’21
How to define typedef struct in c++ dylib in swift
Say I have an example struct in C++ that is inside dylib like this typedef struct { int a; } addingTemp; and I need to use it for a function that adds 2 together, and store it into 3rd value void add(addingTemp a, addingTemp b, addingTemp& c) { c.a = a.a + b.a; } how do I create the struct in swift? this is my adding library function in swift typealias add = @convention(c) (addingTemp, addingTemp, UnsafeMutablePointer<addingTemp>) -> Void func addLib(a : addingTemp, b: addingTemp, out: inout addingTemp) -> Void{ guard dylib != nil else { errorDylib() return } guard let sym = dlsym(dylib, "add") else { errorDylib() return } let f = unsafeBitCast(sym, to:add.self ) let result : Void = f(a ,b, &out) // closeDylib() return } this is my current implementation public class addingTemp: NSObject { public var a : CInt init(a: CInt = 0) { self.a = a } } but it gives me memory access error, it looks like it isn't being stored properly as the type doesn't match. DLL_PUBLIC void add( addingTemp a, addingTemp b, addingTemp* c,); the function works when I only use Int instead of addingTemp class. Also, when the C++ function is calculating, instead of a.a = 1, b.a = 1, it outputs large numbers such as a.a = 389179664 b.a = 389179344
Replies
1
Boosts
0
Views
1.9k
Activity
Nov ’22
Typecasting doesn't work in XCode Version 14.0 (14A309) on MacOS Ventura (13.0 Beta 22A5358e)
I'm working on one of our apps where we have custom NSView class called VLTutorialView. This class has been used as type for contentView of one of the windows. It's been set in both UI as well as the outlet specifies the class as VLTutorialView. However, even after the typecasting as shown as in the screenshot, the class of contentView is NSView and not the required VLTutorialView. Has this issue been observed previously? Any insight would be helpful, and open for queries.
Replies
1
Boosts
0
Views
1.2k
Activity
Oct ’22
ios 16 "Application circumvented Objective-C runtime dealloc"
When I run the program in Xcode beta4, I get an error with: "Application circumvented Objective-C runtime dealloc",How do I solve this problem
Replies
3
Boosts
2
Views
3.1k
Activity
Sep ’22
Crash when trying to reload plugin in runtime with Bundle
I've been playing with runtime plugins reloading using Bundles in Swift. And I've encountered internal crash in conformsToProtocol call while using decoders (JsonDecoder, PlistDecoder etc). This only happens when call PlistDecoder.decode then reload plugin using Bundle.unload, cleanup bundle, load with Bundle.load and call decode in new plugin instance again. As I understand this related to the Swift and Objective-C runtime and the way Bundles/Frameworks are loaded. This doesn't happen if I use NSDictionary to parse plist or json because it doesn't use any runtime magic. Does Swift supports this kind of reloading and if not why is that even possible in this case? Looks more like a bug to me. Also is there a way to reload plugins in runtime without restarting an application? Here's code snippets from my test application Plugin Interface: @objc(PluginInterface) protocol PluginInterface {     init()     func printVersion() } Plugin: struct InfoPlist : Codable {     let CFBundleShortVersionString: String } class Plugin : PluginInterface {     required init() {}     func printVersion() {         print("Current version: \(getVersionFromPlistFile() ?? "nil")")     }     private func getVersionFromPlistFile() -> String? {         let infoPlistPath = Bundle.main.bundlePath + "/Contents/Info.plist"         guard let data = try? Data(contentsOf: URL(fileURLWithPath: infoPlistPath)) else {             return nil         }         let plistData = try? PropertyListDecoder().decode(InfoPlist.self, from: data)         return plistData?.CFBundleShortVersionString     } } Plugin loader: class PluginLoader {     private var pluginBundle: Bundle?     deinit {         unloadDynamicBundle()     }     func load(bundleUrl: URL) -> PluginInterface? {         return loadDynamicBundle(bundleUrl: bundleUrl)     }     func unload() {         unloadDynamicBundle()     }     private func loadDynamicBundle(bundleUrl: URL) -> PluginInterface? {         guard let pluginBundle = Bundle(url: bundleUrl) else {             return nil         }         self.pluginBundle = pluginBundle         do {             try pluginBundle.loadAndReturnError()         } catch {             print("Loading error: \(error.localizedDescription)")             return nil         }         let typeNamed: AnyClass? = pluginBundle.classNamed("Plugin.Plugin")         guard let plugin = initPlugin(from: typeNamed as? PluginInterface.Type) else {             return nil         }         return plugin     }     private func unloadDynamicBundle() {         guard let pluginBundle = pluginBundle else {             return         }         if !pluginBundle.unload() {             return         }         self.pluginBundle = nil     }     private func initPlugin(from type: PluginInterface.Type?) -> PluginInterface? {         if let cls = type {             let plugin = cls.init()             return plugin         }         return nil     } } Here's crash stack trace: Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x000000008dc005f0 Exception Codes: 0x0000000000000001, 0x000000008dc005f0 Exception Note: EXC_CORPSE_NOTIFY Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11 Thread 1 Crashed:: Dispatch queue: com.apple.root.default-qos 0 libswiftCore.dylib 0x7ff8239aa710 swift_conformsToProtocolMaybeInstantiateSuperclasses(swift::TargetMetadata<swift::InProcess> const*, swift::TargetProtocolDescriptor<swift::InProcess> const*, bool) + 2464 1 libswiftCore.dylib 0x7ff8239a9b4e swift_conformsToProtocol + 78 2 libswiftCore.dylib 0x7ff823968fed swift::_conformsToProtocol(swift::OpaqueValue const*, swift::TargetMetadata<swift::InProcess> const*, swift::TargetProtocolDescriptorRef<swift::InProcess>, swift::TargetWitnessTable<swift::InProcess> const**) + 45 3 libswiftCore.dylib 0x7ff8239a91a5 swift::_checkGenericRequirements(__swift::__runtime::llvm::ArrayRef<swift::TargetGenericRequirementDescriptor<swift::InProcess> >, __swift::__runtime::llvm::SmallVectorImpl<void const*>&, std::__1::function<swift::TargetMetadata<swift::InProcess> const* (unsigned int, unsigned int)>, std::__1::function<swift::TargetWitnessTable<swift::InProcess> const* (swift::TargetMetadata<swift::InProcess> const*, unsigned int)>) + 1813 4 libswiftCore.dylib 0x7ff8239a3e19 _gatherGenericParameters(swift::TargetContextDescriptor<swift::InProcess> const*, __swift::__runtime::llvm::ArrayRef<swift::TargetMetadata<swift::InProcess> const*>, swift::TargetMetadata<swift::InProcess> const*, __swift::__runtime::llvm::SmallVectorImpl<unsigned int>&, __swift::__runtime::llvm::SmallVectorImpl<void const*>&, swift::Demangle::__runtime::Demangler&) + 1033 5 libswiftCore.dylib 0x7ff8239a2b03 (anonymous namespace)::DecodedMetadataBuilder::createBoundGenericType(swift::TargetContextDescriptor<swift::InProcess> const*, __swift::__runtime::llvm::ArrayRef<swift::TargetMetadata<swift::InProcess> const*>, swift::TargetMetadata<swift::InProcess> const*) const + 131 6 libswiftCore.dylib 0x7ff8239a119b swift::Demangle::__runtime::TypeDecoder<(anonymous namespace)::DecodedMetadataBuilder>::decodeMangledType(swift::Demangle::__runtime::Node*, unsigned int, bool) + 21499 7 libswiftCore.dylib 0x7ff82399b29d swift_getTypeByMangledNodeImpl(swift::MetadataRequest, swift::Demangle::__runtime::Demangler&, swift::Demangle::__runtime::Node*, void const* const*, std::__1::function<swift::TargetMetadata<swift::InProcess> const* (unsigned int, unsigned int)>, std::__1::function<swift::TargetWitnessTable<swift::InProcess> const* (swift::TargetMetadata<swift::InProcess> const*, unsigned int)>) + 493 8 libswiftCore.dylib 0x7ff82399b06d swift_getTypeByMangledNode + 477 9 libswiftCore.dylib 0x7ff82399b78a swift_getTypeByMangledNameImpl(swift::MetadataRequest, __swift::__runtime::llvm::StringRef, void const* const*, std::__1::function<swift::TargetMetadata<swift::InProcess> const* (unsigned int, unsigned int)>, std::__1::function<swift::TargetWitnessTable<swift::InProcess> const* (swift::TargetMetadata<swift::InProcess> const*, unsigned int)>) + 1002 10 libswiftCore.dylib 0x7ff823998cbd swift_getTypeByMangledName + 477 11 libswiftCore.dylib 0x7ff823998eeb swift_getTypeByMangledNameInContext + 171 12 Plugin 0x10bc74cf9 __swift_instantiateConcreteTypeFromMangledName + 89 13 Plugin 0x10bc75033 protocol witness for Decodable.init(from:) in conformance InfoPlist + 19 14 libswiftCore.dylib 0x7ff82393a5e7 dispatch thunk of Decodable.init(from:) + 7 15 libswiftFoundation.dylib 0x7ff827a61cd8 __PlistDecoder.unbox<A>(_:as:) + 328
Replies
1
Boosts
0
Views
1.3k
Activity
Aug ’22
After upgrade Xcode 13,run playground occur a error。
objc[2247]: Class _PathPoint is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore (0x11a0e8a78) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/TextInputUI.framework/TextInputUI (0x130fb08b0). One of the two will be used. Which one is undefined. objc[2247]: Class _PointQueue is implemented in both /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore (0x11a0e8a50) and /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/PrivateFrameworks/TextInputUI.framework/TextInputUI (0x130fb08d8). One of the two will be used. Which one is undefined.
Replies
6
Boosts
0
Views
8.0k
Activity
Aug ’22
Use of XCFramwork for iOS causes a message error when uploading a build
I use this package in my app:  https://github.com/liamnichols/_InternalSwiftSyntaxParser  which contains an xcframework: _InternalSwiftSyntaxParser.xcframework which contains dylib files All is good with this package, my app works well in simulator and real device. But when I uploaded a version to the App Store Connect, I got this error message: ITMS-90426: Invalid Swift Support - The SwiftSupport folder is missing. Rebuild your app using the current public (GM) version of Xcode and resubmit it. Is there a solution for that? I searched a lot with out any chance to solve it. What I tried: (1) I tried to add manually the SwiftSupport folder using the script here: https://gist.github.com/adamzarn/6bb89d91ed4b8c3d3fb25363c221441f (2) Then the error message is now: ITMS-90430: Invalid Swift Support - The file lib_InternalSwiftSyntaxParser.dylib doesn’t have a signing ID. Sign the file, rebuild your app using the current public (GM) version of Xcode, and resubmit it. (3) Trying to signing the file using: codesign --force --timestamp --sign <name of certificate> <binary you want to sign> But I always get the same error message in (2)
Replies
0
Boosts
0
Views
1.4k
Activity
Aug ’22
Why does modern Xcode generate projects with UIApplicationMain outside of autorelease pool?
If I remember correctly, back in the days Xcode used to generate the main function something like this (at least for iOS applications): int main(int argc, char * argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]); } } I.e. UIApplicationMain function was wrapped inside of @autoreleasepool. However I noticed that currently Xcode no longer does that: int main(int argc, char * argv[]) { NSString * appDelegateClassName; @autoreleasepool { // Setup code that might create autoreleased objects goes here. appDelegateClassName = NSStringFromClass([AppDelegate class]); } return UIApplicationMain(argc, argv, nil, appDelegateClassName); } So, UIApplicationMain is outside of the autorelease pool by default nowadays. Is there any official changelog/paper that explains why the latter implementation is now preferred over the former one?
Replies
1
Boosts
1
Views
1.5k
Activity
Aug ’22
Extend ObjC class with Swift extension Causes crashes when released to Appstore
Hi I have an objective project and when I'm extending the project to Swift It works fine when locally testing it and also when testing it over testflight. But after submitting the app to the appstore and when users download it and use I see crash reports coming from the Sentry related with the swift extensions created over the objective-c class. I'm unable to reproduce this locally. Any Help would be appreciated. Attached the crash report. 605534285f8e4c96af32cf25bb283439-symbolicated.crash
Replies
2
Boosts
0
Views
1.4k
Activity
Jun ’22
Obfuscate Static Library directly
Hi, I have an application Unity that uses the iOS static library. Then this application Unity is build in XCode. I found several utilities that allow you to obfuscate the library in the application. for example this -PPiOS-Rename. I carefully read their documentation "Obfuscate Static Libraries", but at the time of building, the iOS static library are already "hidden in the root" of the Unity app, and XCode cannot obfuscate this. so I need to first obfuscate the library and then add it to the application. Maybe you can suggest another tool(or workaround)? I'll be very grateful.
Replies
0
Boosts
0
Views
948
Activity
Jun ’22
App with CoreNFC.framework crashes on iOS 12.5 with Xcode 13.3.1
I'm developing an app using CoreNFC but it crashes when running on iPhone 6 with iOS 12.5 . Trying to search for an answer I didn't find any solution. When launching the app, this is the error I read in the console: dyld: Library not loaded: /System/Library/Frameworks/CoreNFC.framework/CoreNFC Referenced from: /var/containers/Bundle/Application/327CB0C3-4B7F-4B72-8F70-EEE985F688CD/myAppName.app/myAppName Reason: image not found I've already added CoreNFC.Framework in Targets -> General -> Frameworks, Libraries, and Embedded Content and set it to "Do Not Embed" but it doesn't work. Is there any solution for this? Or is it a bug of Xcode? Please help. Thanks
Replies
1
Boosts
0
Views
2.4k
Activity
May ’22
Is it possible to develop a file ?
I’m asking for knowledge after researching the documentation and found the File System in the filter search, if I migrate my code to export it from Objective-C to Swift to access the file system, can a code my own file extension ?
Replies
1
Boosts
0
Views
1.3k
Activity
May ’22
Installing app from the App Store, app is automatically launched into the background
We have noticed recently that when our app is installed from the App Store, it is automatically launched into the background. After the App Store installs our app, it is started into the background (no UI) without the user pressing ‘Open’ from the App Store or tapping the app icon in the home screen. Testing with iOS 15. I assume this is not the correct behavior, an app automatically being launched after being installed. I submitted a bug report (FB9971657), but wanted to know if anyone else was seeing this behavior.
Replies
2
Boosts
0
Views
2.1k
Activity
Apr ’22
EXC_GUARD crash (guarded with 0x08fd4dbfade2dead)
Hi everyone, How should I find the root cause of this type of crash with 0x08fd4dbfade2dead? Some file descriptor which is protected but my code closed it, is it correct? But Here's the crash log and from top is close + 8, stack num.1 is a CFRelease(a) function, we do check if a is null before call CFRelease on it. And the for next a few lines are (number 2-6), we don't see any of those function calls open or close a file, no socket network call at all. No sqlite, coredata or even dup and etc... Is there a memory management issue which makes the a point to somewhere else which is the file descriptor?
Replies
1
Boosts
0
Views
1.5k
Activity
Mar ’22
The metal-cpp wrapper causes a segfault when calling renderCommandEncoderWithDescriptor:
The metal-cpp wrapper released end of last year wraps the Metal 2 API, and by extension the basic NS foundation, in C++ code. From looking through the code, metal-cpp uses the objc/runtime.h header and uses objc_msgSend and sel_registerName to fetch pointers and call methods as if it were Objective-C code. This mostly works, however I've come across an issue where the renderCommandEncoderWithDescriptor: selector fails to load through sel_registerName. My application creates the default metal device, a command queue, a CAMetalLayer and I can present the drawable through a command buffer and all of it works. However, if I want to start actually rasterising any geometry, I need a MTLRenderCommandEncoder. To create one, I need to call renderCommandEncoderWithDescriptor: on a MTLCommandBuffer, which causes a segfault because the selector is 0x0 and the Objective-C runtime code tries to read from it. This short snippet is where the segfault occurs. Calling MTL::CommandBuffer::renderCommandEncoder will call the objc_msgSend with a 0x0 selector. auto buffer = queue->commandBuffer(); auto encoder = buffer->renderCommandEncoder(renderPass); MTLCommandBuffer buffer = [queue commandBuffer]; MTLRenderCommandEncoder encoder = [buffer renderCommmandEncoderWithDescriptor:renderPass]; And this would be the equivalent in raw Objective-C code, which does in fact work. I have uploaded a small test example to GitHub: https://github.com/spnda/metal-cpp-bug. This example uses GLFW to create the window and I use a small Objective-C++ file to modify the NSWindow and CAMetalLayer, as the metal-cpp wrapper curiously does not provide wrappers for these classes. I am personally on macOS Monterey 12.3 with a M1 iMac 24", it would be interesting to see if this is an issue with everybody, or just specific to my setup. Not being able to create a MTL::RenderCommandEncoder makes Apple's official Metal C++ wrappers absolutely useless for any rendering, and I would much appreciate any help to fix this issue.
Replies
1
Boosts
0
Views
1.6k
Activity
Mar ’22
Are bigSur .dylib libraries hidden under vecLib.framework?
I understand what the *.tbd files are doing however what I don't understand is why when I look at the install-name: key there is a path for the actual *.dylib library however I cannot see these, they don't exist with ls. For example below is the head of the MacOSX11.3.sdk/usr/lib/libblas.tbd yaml file: --- !tapi-tbd tbd-version: 4 targets: [ x86_64-macos, x86_64-maccatalyst, x86_64h-macos, x86_64h-maccatalyst, arm64-macos, arm64-maccatalyst, arm64e-macos, arm64e-maccatalyst ] uuids: - target: x86_64-macos value: 86F0C2E1-6A2D-34E8-AA84-D4224BB49B33 - target: x86_64-maccatalyst value: 86F0C2E1-6A2D-34E8-AA84-D4224BB49B33 - target: x86_64h-macos value: 8151F97D-CE36-3B38-AEF0-AAC55E9F537B - target: x86_64h-maccatalyst value: 8151F97D-CE36-3B38-AEF0-AAC55E9F537B - target: arm64-macos value: 00000000-0000-0000-0000-000000000000 - target: arm64-maccatalyst value: 00000000-0000-0000-0000-000000000000 - target: arm64e-macos value: 46295B04-B6A4-36A1-A4F7-C9B606CF75A5 - target: arm64e-maccatalyst value: 46295B04-B6A4-36A1-A4F7-C9B606CF75A5 install-name: '/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib' exports: - targets: [ arm64e-macos, x86_64-macos, x86_64h-macos, x86_64-maccatalyst, It says the install-name is /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib But I cannot see this file and I am afraid neither can the projects I am trying to compile with cmake/make. $ ls /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib ls: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib: No such file or directory
Replies
2
Boosts
0
Views
2.3k
Activity
Mar ’22
objc_copyClassList() not enumerable?
This is a derivative of this and this. On iOS 15(.3.1), if I just try to fetch and enumerate the classes of the objc runtime, waiting until viewDidAppear() to make sure there wasn't some initialization issue: var count = UInt32(0) var classList = objc_copyClassList(&count)! print("COUNT \(count)") print("CLASS LIST \(classList)") for i in 0..<Int(count) { print("\(i)") classList[i] } produces the following before a Thread 1: EXC_BREAKPOINT (code=1, subcode=0x1820e0cdc) COUNT 28353 CLASS LIST 0x000000010bf24000 0 1 2 2022-02-17 16:24:02.977904-0800 TWiG V[2504:705046] *** NSForwarding: warning: object 0x1dbd32148 of class '__NSGenericDeallocHandler' does not implement methodSignatureForSelector: -- trouble ahead 2022-02-17 16:24:02.978001-0800 TWiG V[2504:705046] *** NSForwarding: warning: object 0x1dbd32148 of class '__NSGenericDeallocHandler' does not implement doesNotRecognizeSelector: -- abort I don't know how to do any less with it than just fetching the value. I'm not trying to print it or anything, and yet it still fails. Is there some magic I'm missing? Why have the API if the results crash your program? If the issue is legit, it would be nice of the docs pointed out a workaround, or at least the proper way to cope with the result. (I do not have hardened runtime turned on, XCode 13.2.1)
Replies
3
Boosts
0
Views
1.3k
Activity
Feb ’22
[Objective-C] Proper way of calling an overrided base interface method while using a category
Hi, For some of my use cases, I'm extending an interface using a category. I am overriding some of the methods in the base Interface, but want to call the base interface method after I'm done with the workflow inside the category method. Essentially, doing something similar to a "super" call. While I was looking into how to achieve this, have found something called Method Swizzling( https://nshipster.com/method-swizzling/ , https://newrelic.com/blog/best-practices/right-way-to-swizzle), but this looks too 'hacky'. Is there a better way to achieve this?
Replies
4
Boosts
0
Views
1.4k
Activity
Jan ’22
How to deduce from NSMethodSignature that a struct argument is passed by pointer?
How to deduce from NSMethodSignature that a struct argument is passed by pointer? Specifically on ARM. For example if I have: @protocol TestProtocol <NSObject> - (void)time:(CMTime)time; - (void)rect:(CGRect)point; @end And then I do: struct objc_method_description methodDescription1 = protocol_getMethodDescription(@protocol(TestProtocol), @selector(time:), YES, YES); struct objc_method_description methodDescription2 = protocol_getMethodDescription(@protocol(TestProtocol), @selector(rect:), YES, YES); NSMethodSignature *sig1 = [NSMethodSignature signatureWithObjCTypes:methodDescription1.types]; NSMethodSignature *sig2 = [NSMethodSignature signatureWithObjCTypes:methodDescription2.types]; const char *arg1 = [sig1 getArgumentTypeAtIndex:2]; const char *arg2 = [sig2 getArgumentTypeAtIndex:2]; NSLog(@"%s %s", methodDescription1.types, arg1); NSLog(@"%s %s", methodDescription2.types, arg2); The output is: v40@0:8{?=qiIq}16 {?=qiIq} v48@0:8{CGRect={CGPoint=dd}{CGSize=dd}}16 {CGRect={CGPoint=dd}{CGSize=dd}} Both look similar, no indication that CMTime will be actually passed as a pointer. But when I print the debug description: NSLog(@"%@", [sig1 debugDescription]); NSLog(@"%@", [sig2 debugDescription]); The first prints: ... argument 2: -------- -------- -------- -------- type encoding (^) '^{?=qiIq}' flags {isPointer} ... While the second prints: ... argument 2: -------- -------- -------- -------- type encoding ({) '{CGRect={CGPoint=dd}{CGSize=dd}}' flags {isStruct} ... So this information is indeed stored in the method signature, but how do I retrieve it without parsing the debug description? Are there rules I can use to deduce this myself? I tried to experiment with different structs but it is hard to spot a pattern.
Replies
3
Boosts
0
Views
1.5k
Activity
Jan ’22
App crash with NSInvalidArgumentException
we got the following crash from one of our customers: crash log this is happening once they initialize our SDK, with the following command: public static func initialize() { SDKManager.shared().setup(AppKey) } the shared() call doesn't seem to have the crash error since it uses a dispatch_once which in that case would have been displayed in the crash log. the setup method is just a facade method that calls another method which acts as facade as well. after this, in the 3rd method there is bunch of things happening. the issue is that if we look into the crash log, we see only 2 calls to the SDK framework, which like i said are only 2 facades. - (void)setup:(NSString *)appKey {   [self initSDK:appKey]; } - (void)initSDK:(NSString *)appKey {   [self initSDK:appKey withParams:nil]; } its also not clear, what does the mention of objc-runtime-new.mm have to do with this crash since the SDK does not import or access any runtime objects. also, unfortunately we do not have a valid dsym to decrypt the 2 calls pointing to the SDK.
Replies
0
Boosts
0
Views
905
Activity
Dec ’21
Error in Xcode 13.1 when running the app in device
Hi. I am working on Xcode 13.1 When I am building my code and running it on my iPhone (Not on the simulator), the code is crashing. Below is the error message. Please help me out anyone..... *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSBundle initWithURL:]: nil URL argument' *** First throw call stack: (0x1827e9cac 0x199858758 0x183f3c0e0 0x183f12d64 0x103288590 0x1032884b4 0x103288d30 0x102d87544 0x102d86000 0x184c59804 0x184c5c178 0x184d57360 0x184d53a04 0x184f6c928 0x184e4be78 0x184d7a73c 0x1dc3649d4 0x184c3ab28 0x1862a4c4c 0x186297d40 0x1862ab4a4 0x1862b408c 0x184c14b50 0x182795f34 0x182767578 0x182762b0c 0x182775d8c 0x19c8829a0 0x184faafa8 0x184d3f22c 0x102d5bbb0 0x104288190) libc++abi: terminating with uncaught exception of type NSException dyld4 config: DYLD_LIBRARY_PATH=/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSBundle initWithURL:]: nil URL argument' terminating with uncaught exception of type NSException
Replies
1
Boosts
0
Views
1k
Activity
Dec ’21