Hi there,
I'm working on an app that contains a mini system monitoring utility. I would like to list the top CPU-using processes.
As Quinn “The Eskimo!” has repeatedly cautioned, relying on private frameworks is just begging for maintenance effort in the future. Ideally, I want to go through public headers/frameworks.
I've gone to great lengths to try to find this information myself, and at this point I'm just struggling. I detail my research below.
Any pointers in the right direction would be much appreciated!
Attempts
Libproc
First I looked at libproc. Using proc_pidinfo with PROC_PIDTHREADINFO, I'm able to get each thread of an app, with its associated CPU usage percentage. Summing these, I could get the total for an app.
Unfortunately, this has two downsides:
Listing a table of processes now takes O(proces_count) rather than just O(process_count), and causes way more syscalls to be made
It doesn't work for processes owned by other users. Perhaps running as root could alleviate that, but that would involve making a priviliedged helper akin to the existing sysmond that Activity Monitor.app uses. I'm a little scared of that, because I don't want to put my users at risk.
Sysctl
Using the keys [CTL_KERN, KERN_PROC, KERN_PROC_PID, someProcessID], I'm able to get a kinfo_proc - https://github.com/apple-opensource/xnu/blob/24525736ba5b8a67ce3a8a017ced469abe101ad5/bsd/sys/sysctl.h#L750-L776 instance. Accessing its .kp_proc - https://github.com/apple-opensource/xnu/blob/24525736ba5b8a67ce3a8a017ced469abe101ad5/bsd/sys/proc.h#L96-L150.p_pctcpu - https://github.com/apple-opensource/xnu/blob/24525736ba5b8a67ce3a8a017ced469abe101ad5/bsd/sys/proc.h#L123 looked really promising, but that value is always zero.
Digging deeper, I found the kernel code that fills this struct in (fill_user64_externproc - https://github.com/apple-opensource/xnu/blob/c76cff20e09b8d61688d1c3dfb8cc855cccb93ad/bsd/kern/kern_sysctl.c#L1121-L1168). The assignment of p_pctcpu - https://github.com/apple-opensource/xnu/blob/c76cff20e09b8d61688d1c3dfb8cc855cccb93ad/bsd/kern/kern_sysctl.c#L1149 is in a conditional region, relying on the _PROC_HAS_SCHEDINFO_ flag. Disassembling the kernel on my mac, I could confirm that the assignment of that field never happens (thus _PROC_HAS_SCHEDINFO_ wasn't set during compilation, and the value will always stay zero)
Reverse engineering Activity Monitor.app
Activity Monitor.app makes proc_info and sysctl system calls, but from looking at the disassembly, it doesn't look like that's where its CPU figures come from. From what I can tell, it's using private functions from /usr/lib/libsysmon.dylib.
That's a user library which wraps an XPC connection to sysmond (/usr/libexec/sysmond), allowing you to create requests (sysmon_request_create), add specific attributes you want to retrieve (sysmon_request_add_attribute), and then functions to query that data out (sysmon_row_get_value).
Getting the data "striaght from the horses mouth" like this sounds ideal. But unfortunately, the only documentation/usage I can find of sysmond is from bug databases demonstrating a privilege escalation vulnerability lol. There are some partial reverse engineered header files floating around, but they're incomplete, and have the usual fragility/upkeep issues associated with using private APIs.
On one hand, I don't want to depend on a private API, because that takes a lot of time to reverse engineer, keep up with changes, etc. On the other, making my own similar privileged helper would be duplicating effort, and expose a bigger attack surface. Needless to say, I have no confidence in being able to make a safer privileged helper than Apple's engineers lol
Reverse engineering iStat Menus
Looks like they're using proc_pid_rusage - https://github.com/apple-opensource/xnu/blob/24525736ba5b8a67ce3a8a017ced469abe101ad5/libsyscall/wrappers/libproc/libproc.h#L103-L108 .
However, I don't know how to convert the cpu_*_time fields of the resulting struct rusage_info_v4 - https://github.com/apple-opensource/xnu/blob/24525736ba5b8a67ce3a8a017ced469abe101ad5/bsd/sys/resource.h#L306-L343 to compute a "simple" percentage. Even if I came up with some formula that produces plausible looking results, I have no real guarantee it's correct or equivalent to what Activity Monitor shows.
Objective-C
RSS for tagObjective-C is a programming language for writing iOS, iPad OS, and macOS apps.
Posts under Objective-C tag
200 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
I create a protocol that had, among other things:
@objc func setList(_: [MyType], withReply: @escaping (Error?) -> Void)
The daemon part is in Swift, while the calling part is in Objective-C. Because why not? (Actually, because the calling part has to deal with C++ code, so that's ObjC++; however, I wanted the stronger typing and runtime checking for the daemon part, so I wrote it in Swift.) The ObjC part uses NSArray<MyType*>.
I set up an NSXPCConnection link, and create a (synchronous) proxy with the right protocol name. But when I try to do the XPC setList call, I get an error. I assume that's because it doesn't like the signature. (Surely this is logged somewhere? I couldn't find it, if so. 😩) But... if I have a signature of @objc func addItem(_: MyType, withReply: @escaping (Error?) -> Void), then it works. So I assume it's the array. (Oh, I've also tried it without the @objc; the protocol itself is defined as @objc.)
I've tried changing to protocol signature to using NSArray, but same thing.
Good day!
I'm interested in if there is any way to query CPU/GPU/Battery temperature values on recent iOS systems?
I've tried to search forums for "cpu temp", "ios temperature", "battery temperature" etc., but didn't find anything.
There was only mentioned some old private API which was supposed to work somehow for iOS<10. All the examples I've found didn't even compile. All the requests and suggestions are pretty old and seems irrelevant.
So I decided to bump this topic. Are there any updates?
Any hints and suggestions are highly appreciated!
Best regards!
I've been seeing this crash happening for a few years now. It's rare and unreproducible. The App's storyboard is large and it can occur on any segue and randomly it seems
Could not find a navigation controller for segue 'some-segue-on-storyboard'. Push segues can only be used when the source controller is managed by an instance of UINavigationController.
I've tried various things to prevent it. Double checked it was on the main thread to keep the UI happy and assumed all this time that it was just an iOS glitch/bug that Apple would get around to fixing.
That or it is a side effect of low memory.
Anyone got any suggestions for how to fix or what to investigate?
When my app enter to background, I start a background task, and when Expiration happens, I end my background task. The code likes below:
backgroundTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
dispatch_async(dispatch_get_main_queue(), ^{
if (backgroundTask != UIBackgroundTaskInvalid) {
[[UIApplication sharedApplication] endBackgroundTask:backgroundTask];
backgroundTask = UIBackgroundTaskInvalid;
[self cancel];
}
});
}];
When the breakpoint is triggered at the endBackgroundTask line, I also get the following log:
[BackgroundTask] Background task still not ended after expiration handlers were called: <UIBackgroundTaskInfo: 0x282d7ab40>: taskID = 36, taskName = Called by MyApp, from MyMethod, creationTime = 892832 (elapsed = 26). This app will likely be terminated by the system. Call UIApplication.endBackgroundTask(:) to avoid this.
The log don't appear every time, so why is that? Is there something wrong with my code?
Currently, we have a Flutter app that uses the network_info_plus plugin to connect to the Wifi network of the current iOS device our app is running on. Unfortunately, we are unable to use Bonjour on the target device that we are attempting to connect to, which acts as an AP, due to legacy device issues. Hence the reason why we use the device's Wifi IP address to interact with this device when it's connected to this device's Access Point.
This plugin's iOS implementation is using a non-guaranteed way of fetching the device's Wifi IP address according to a recent DevForum post, presuming that it's en0 as seen here:
- (void)enumerateWifiAddresses:(NSInteger)family
usingBlock:(void (^)(struct ifaddrs *))block {
struct ifaddrs *interfaces = NULL;
struct ifaddrs *temp_addr = NULL;
int success = 0;
// retrieve the current interfaces - returns 0 on success
success = getifaddrs(&interfaces);
if (success == 0) {
// Loop through linked list of interfaces
temp_addr = interfaces;
while (temp_addr != NULL) {
if (temp_addr->ifa_addr->sa_family == family) {
// en0 is the wifi connection on iOS
if ([[NSString stringWithUTF8String:temp_addr->ifa_name]
isEqualToString:@"en0"]) {
block(temp_addr);
}
}
temp_addr = temp_addr->ifa_next;
}
}
// Free memory
freeifaddrs(interfaces);
}
I was just wondering what an alternative Objective-C implementation would look like for fetching the actual IP address using a subnet broadcast, since the aforementioned DevForum post suggested that we get all Ethernet-like interfaces (I'm assuming those devices that are prefixed with en) and create a Socket for them bound to IP_BOUND_IF.
Thank you in advance.
hi, community, I am using qt framework and faced with internal issue on macOS 14.0, haven't found any similar reports, maybe already known issue
-------------------------------------
Translated Report (Full Report Below)
-------------------------------------
Process: Test [99529]
Path: /Applications/Test.app/Contents/MacOS/Test
Identifier: com.test.osx
Version: 0.0.1 (00000)
Code Type: ARM-64 (Translated)
Parent Process: launchd [1]
User ID: 507
Date/Time: 2023-07-21 10:37:25.1947 +0200
OS Version: macOS 14.0 (23A5286i)
Report Version: 12
Anonymous UUID: 191461AA-EC46-D583-CB70-47FA103D8F89
Sleep/Wake UUID: 35433ED4-693B-46C2-9622-99C4FAD6B28F
Time Awake Since Boot: 300000 seconds
Time Since Wake: 3295 seconds
System Integrity Protection: enabled
Crashed Thread: 0 CrBrowserMain Dispatch queue: com.apple.main-thread
Exception Type: EXC_ARITHMETIC (SIGFPE)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Termination Reason: Namespace SIGNAL, Code 8 Floating point exception: 8
Terminating Process: exc handler [99529]
Thread 0 Crashed:: CrBrowserMain Dispatch queue: com.apple.main-thread
0 libRosettaRuntime 0x11eb5220c 0x11eb12000 + 262668
1 libsystem_platform.dylib 0x7ff80c666393 _sigtramp + 51
2 TextInputUIMacHelper 0x7ffc0c34f3d2 -[TUINSCursorUIController moveTextInputMenuHUD:] + 258
3 HIToolbox 0x7ff8176055fc TSMMessagePortCallBack + 2779
4 CoreFoundation 0x7ff80c7ad385 __CFMessagePortPerform + 690
5 CoreFoundation 0x7ff80c714c24 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41
6 CoreFoundation 0x7ff80c714b5e __CFRunLoopDoSource1 + 530
7 CoreFoundation 0x7ff80c7137e1 __CFRunLoopRun + 2704
8 CoreFoundation 0x7ff80c712749 CFRunLoopRunSpecific + 557
9 HIToolbox 0x7ff817472aa9 RunCurrentEventLoopInMode + 292
10 HIToolbox 0x7ff8174728b6 ReceiveNextEventCommon + 665
11 HIToolbox 0x7ff817472601 _BlockUntilNextEventMatchingListInModeWithFilter + 66
12 AppKit 0x7ff80fc151b5 _DPSNextEvent + 880
13 AppKit 0x7ff8104edf0f -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1304
14 AppKit 0x7ff80fc06a56 -[NSApplication run] + 603
15 libqcocoa.dylib 0x124849547 QCocoaEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 2631
16 QtCore 0x127b76826 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 486
17 QtCore 0x127b6d617 QCoreApplication::exec() + 119
After updating to xcode 14.3 with RN 0.69.9, my project can't build anymore. It's throwing the error for all of my custom view managers.
The error i'm getting is: A function declaration without a prototype is deprecated in all versions of C when I'm using RCT_EXTERN_MODULE
Output of npx react-native info:
System:
OS: macOS 13.4.1
CPU: (8) arm64 Apple M1 Pro
Memory: 77.59 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 16.13.1 - ~/.nvm/versions/node/v16.13.1/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v16.13.1/bin/yarn
npm: 8.1.2 - ~/.nvm/versions/node/v16.13.1/bin/npm
Watchman: 2023.07.10.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.12.1 - /Users/avarisco/.rvm/gems/ruby-2.7.4/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
Android SDK: Not Found
IDEs:
Android Studio: Not Found
Xcode: 14.3/14E222b - /usr/bin/xcodebuild
Languages:
Java: Not Found
npmPackages:
@react-native-community/cli: Not Found
react: 18.0.0 => 18.0.0
react-native: 0.69.9 => 0.69.9
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
As per apple documentation we are setting textContentType with "" in order to disable password auto fill view option on keyboards which is working fine in all iOS versions below 17 beta.
Seems like it broke & password auto fill view option appearing on keyboards for iOS 17 beta versions even on setting textContentType with "" & inputAccessoryView as nil
self.username.textContentType = @"";
self.password.textContentType = @"";
I'm getting undefined symbol for my own Swift class used from ObjC when linking in x86_64. I pinpointed the issue to using CheckedContinuation inside the class, because if I remove the use of it, it links. What could be the issue?
I have a static library staticLib.a which is witten mostly in C++ with one additional obj-C class MyClass. There are two dynamic libs, dynamicLib_A. dylib and dynamicLib_B.dylib are linked with the static lib.
When starting the application which loads the dynamic libs at runtime it comes out the following warning:
objc[15078]: Class MyClass is implemented in both /path/to/libdynamicLib_A.dylib (0x104f03f90) and /path/to/libdynamicLib_B.dylib (0x10dbf3f48). One of the two will be used. Which one is undefined.
It can be found that the C++ names are mangled. For instance, both libdynamicLib_A.dylib and libdynamicLib_B contains string:
__ZN18MyClassBC2Ev
It looks like the obj-c class name is not mangled. Both libdynamicLib_A.dylib and libdynamicLib_B contains string:
00000000012b7f48 S OBJC_CLASS$_MyClass
Question: How to avoid this warning? Why it complains only about the obj-c class but not the C++ class? Is this issue related to name mangling?
I ran across the following crash while using one of our apps.
The app crashes since the recent iOS 17 beta builds.
The code crashes when using valueForKey on an NSArray with objects that implement NSCopying.
like: [@[[Sample new]] valueForKey:@"copy"];
or: [[Sample new] valueForKey:@"copy"];
header:
@interface Sample : NSObject<NSCopying>
- (Sample *)copy;
- (Sample *)copyWithZone:(nullable NSZone *)zone;
@end
implementation:
@implementation Sample
- (Sample *)copy {
return [super copy];
}
- (Sample *)copyWithZone:(nullable NSZone *)zone {
return self;
}
@end
Any idea why this might be happening?
I have created a feedback too: FB12819891
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 <iostream>
#include <stdlib.h>
#include <time.h>
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;
}
return x;
}
long long int mod(long long int x, long long int y, long long int n)
{
if (x%n==0)
{
return 0;
}
long long int result;
for (result=1; y>1; x=(x*x)%n)
{
if (y%2==1)
{
result = (result * x)%n;
y=(y-1)/2;
}
else if (y%2==0)
{
y=y/2;
}
}
x=(x*result)%n;
return x;
}
int main()
{
// Random Prime Numbers------------------------------//
cout << "Input digits" << endl;
int k;
cin >> k;
cout << "Input letter for encryption" << endl;
char f;
cin >> f;
long long int M=pow(10, k)-1;
long long int m=pow(10, k-1);
bool prime[M+1];
memset(prime, true, sizeof(prime));
for(long long int p=2; p*p<=M; p=p+1 )
{
if (prime[p] == true)
{
for (long long int i=p*p; i<=M; i=i+p)
prime[i]=false;
}
}
int prime2[M+1];
for (long long int t=0; t<=M; t=t+1)
{
prime2[t]=1;
}
for (long long int p=m, t=1; p<=M; p=p+1)
{
if(prime[p]==true)
{
prime2[t]=p;
t=t+1;
}
}
long long int h = count(prime, prime+M+1, true);
long long int l = count(prime, prime+m, true);
h=h-l;
srand(time(NULL));
M=rand()%h+1;
m=rand()%h+1;
if (M==m)
{
m=(M*1000)%h+1;
}
if (M>h)
{
cout << "a=" << M << " error!" << endl;
}
else if (m>h)
{
cout << "b=" << m << " error!" << endl;
}
else
{
M=prime2[M];
m=prime2[m];
}
// Generating RSA keys----------------------------//
long long int n = M*m;
long long int fin = (M-1)*(m-1);
// Generating random e for the public key {e, n}--------//
long long int number[fin+1];
for (long long int i=0; i<=fin; i=i+1)
{
number[i]=0;
}
for (long long int i=2, k=1; i<=fin; i=i+1)
{
if (gcd(i, fin)==1)
{
number[k]=i;
k=k+1;
}
}
long long int z = fin+1-count(number, number+fin+1, 0);
srand(time(NULL));
long long int r = rand()%z +1;
long long int e = number[r];
long long int e2 = e;
long long int d=0;
for (long long int x=1, y=0, k=1, t=1; e2%fin!=0; k=1, d=y)
{
t=y;
y=x-y*(e2/fin);
x=t;
k=fin;
fin=e2%fin;
e2=k;
}
cout << endl << "The public key is {" << e << " , " << n << "}" << endl;
cout << "The private key is {" << d << " , " << n << "}" << endl;
// e、d、n acquired
// Encryption begins----------------------------//
long long int f2 = (int)f;
f2 = mod(f2, e, n);
cout << "The cyphertext is " << f2 << endl;
f2 = mod(f2, d, n);
f = (char)f2;
cout << f << endl;
}
the xcode will freze for 3mins when hit a breakpoint. it report "Fetching variables on ***'s iPhone"
it happens when hit a new breakpoint, and the xcode will freeze for 3mins, then it will be ok. anysolution? its wasting my time.
the xcode continue print the log below:
(arm64) /Users/xx/Desktop/patch/Project/Pods/TestSDK/vendor/***.framework/***(FPEncryptMsg.pb-c.o) 0x00000c22: unable to locate module needed for external types: /Users/packagedevice/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/38MC9CUKFC6LS/Darwin-MI6WZSG1PNOM.pcm
error: '/Users/packagedevice/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/38MC9CUKFC6LS/Darwin-MI6WZSG1PNOM.pcm' does not exist
Debugging will be degraded due to missing types. Rebuilding the project will regenerate the needed module files.
Our project has many dependencies which are binary file. And these dependencies are build in the remote serve。Anyone has ideas about this
I have an app using in app purchase to buy diamonds And to buy diamonds i want to use in app purchase, Paid Apps agreement activated. I already defined product_id from API
[self.delegate applePayShowHUD];
NSDictionary *dics = @{
@"uid":[Config getOwnID],
@"coin":[dic valueForKey:@"coin_ios"],
@"money":[dic valueForKey:@"money"],
@"changeid":dic[@"id"]
};
[YBToolClass postNetworkWithUrl:@"Charge.getIosOrder" andParameter:dics success:^(int code, id _Nonnull info, NSString * _Nonnull msg) {
if (code == 0) {
NSString *infos = [[info firstObject] valueForKey:@"orderid"];
self.OrderNo = infos;//订单
//苹果支付ID
NSString *setStr = [NSString stringWithFormat:@"%@_testing",[dic valueForKey:@"product_id"]];
NSSet *set = [[NSSet alloc] initWithObjects:setStr, nil];
self.request = [[SKProductsRequest alloc] initWithProductIdentifiers:set];
self.request.delegate = self;
[self.request start];
}
else{
[self.delegate applePayHUD];
dispatch_async(dispatch_get_main_queue(), ^{
[MBProgressHUD showError:msg];
});
}
} fail:^{
}];
}
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
[self.delegate applePayHUD];
self.products = response.products;
self.request = nil;
for (SKProduct *product in response.products) {
NSLog(@"已获取到产品信息 %@,%@,%@",product.localizedTitle,product.localizedDescription,product.price);
self.product = product;
}
if (!self.product) {
dispatch_async(dispatch_get_main_queue(), ^{
[self showAlertView:YZMsg(@"无法获取商品信息")];
});
return;
}
//3.获取到产品信息,加入支付队列
SKPayment *payment = [SKPayment paymentWithProduct:self.product];
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
[[SKPaymentQueue defaultQueue] addPayment:payment];
}
and i already put the product in app store connect like this
i put configuration too in xcode
<SKProduct: 0x2833d8890>: Skipping product "coin_3000_testing" because no price was available
I always get skipping product, Am i missing something here ?
I test this in real device directly from xcode, not testflight
Is there a way to catch the crashes from both swift and obj-c without using any 3rd party libraries?
I want a way to note that my app has crashed, no stack trace needed just want some count of crashes stored to user defaults.
I saw NSSetUncaughtExceptionHandler being used but it is only catching obj-c related errors.
eg. force unwrapping nil is not caught here.
I want a universal way of catching the crashes. also want to know if this can affect the crash reporting by 3rd party libraries
How to Setup "Multi-OS Engine" in Xcode
When I build and run my Objective-C project—consisting of the files main.m, BNRLogger.h, and BNRLogger.m—in Xcode, the function appLaunch: is supposed to be executed whenever a non-background application without the LSUIElement key in its Info.plist file launches on my MacBook. But that doesn't appear to be happening; the message "An app has started up!" doesn't show up in the Xcode console when an app (e.g., Blender) launches. What's going on? Have I failed to ensure that appLaunch: is called when an NSWorkspaceDidLaunchApplicationNotification is posted, or is no such notification being posted when an app launches?
This is what main.m looks like:
#import <Cocoa/Cocoa.h>
#import "BNRLogger.h"
int main(int argc, const char * argv[]) {
@autoreleasepool {
BNRLogger *logger = [[BNRLogger alloc] init];
[[NSNotificationCenter defaultCenter] addObserver:logger
selector:@selector(appLaunch:)
name:NSWorkspaceDidLaunchApplicationNotification
object:nil];
[[NSRunLoop currentRunLoop] run];
}
return 0;
}
BNRLogger.h looks like this:
#import <Foundation/Foundation.h>
#ifndef BNRLogger_h
#define BNRLogger_h
@interface BNRLogger : NSObject
@end
#endif
And here are the contents of BNRLogger.m:
#import "BNRLogger.h"
@interface BNRLogger ()
- (void)appLaunch:(NSNotification *)note;
@end
@implementation BNRLogger
- (void)appLaunch:(NSNotification *)note {
NSLog(@"An app has started up!");
}
@end
I have an Objective C++ wrapper class called ImageDividerWrapper in which there is a function I want to use in a Swift class called FrameProcessor.
Inside the ImageDividerWrapper.h file I made sure to import the bridging header. I also double-checked that the bridging header was referenced and spelled correctly in Project/Build Settings/Swift Compiler. I also deleted derived data, cleaned build folder, etc..
Also imported ImageDividerWrapper.h into my bridging header file:
#import "ImageDividerWrapper.h"
And in my ImageDividerWrapper header file I include:
#import "Vsn3-Bridging-Header.h"
Unfortunately, I still continue to get the error: "No such module 'ImageDividerWrapper'" when trying to directly import the Objective C++ class into my Swift file with:
import ImageDividerWrapper
If anyone who has solved this problem before can point me in the right direction, I would appreciate it so much!
Thank you!
I was migrating from Xcode 14 -> 15, and noticed that my code was failing with dyld[46534]: Symbol not found: _OBJC_CLASS_$_NSError
I was able to debug the problem to some old objective c code, as documented in this thread: https://github.com/RonRadtke/react-native-blob-util/issues/273
The error seems to stem from this particular try catch block
@try {
// Some code
}
@catch(NSError *er) {
// handle error
}
When I convert the code to catch an NSException instead, the runtime error goes away. Understandably, according to the apple docs, it should be throwing an NSException in the first place, but the documents do say
Important: Although you can throw and catch objects other than NSException objects, the Cocoa frameworks themselves might only catch NSException objects for some conditions. So if you throw other types of objects, the Cocoa handlers for that exception might not run, with undefined results. (Conversely, non-NSException objects that you throw could be caught by some Cocoa handlers.) For these reasons, it is recommended that you throw NSException objects only, while being prepared to catch exception objects of all types.
So it seems like this should not have produced a runtime error. I wanted to flag this in case the underlying code behind the @try @catch changed unintentionally.