Dive into the world of programming languages used for app development.

Posts under General subtopic

Post

Replies

Boosts

Views

Activity

iOS cpu/gpu/battery temperature readings
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!
4
1
7.8k
Oct ’23
objc4-818.2 object_cxxDestructFromClass implementation
Below is the implementation of the object_cxxDestructFromClass method. the line below the for loop if (!cls->hasCxxDtor()) return; Some questions: If a subclass inherits a parent class, and one of the middle classes does not have a CxxDtor, but the parent class does, will there be any problems with the release of the instance? static void object_cxxDestructFromClass(id obj, Class cls) { void (*dtor)(id); // Call cls's dtor first, then superclasses's dtors. for ( ; cls; cls = cls->getSuperclass()) { if (!cls->hasCxxDtor()) return; dtor = (void(*)(id)) lookupMethodInClassAndLoadCache(cls, SEL_cxx_destruct); if (dtor != (void(*)(id))_objc_msgForward_impcache) { if (PrintCxxCtors) { _objc_inform("CXX: calling C++ destructors for class %s", cls->nameForLogging()); } (*dtor)(obj); } } }
0
0
548
Oct ’23
Using VoiceOver's accessibilityCustomActions and supporting Voice Control for the group subviews
Hi, My app supports VoiceOver and VoiceControl, and I find it hard or perhaps even impossible to support both when it comes to grouping accessibility elements. I have an element containing multiple subviews, and I want to define it as a group of accessibility custom actions to enhance VoiceOver navigation. (So that the user can focus on the entire element, and just swipe up or down if they want to activate one of its subviews as a custom action). To do that, I'm setting isAccessibilityElement to YES and I'm using accessibilityCustomActions where I create a custom action for each of this element's subviews. This works fine and presents the accessibility custom actions as expected. The struggle comes when I try to combine it with Voice Control. Since the element contains multiple subviews, I want each of these subviews to be accessible when using Voice Control with item numbers, for example. Instead, Voice Control is setting a number only on the entire element, ignoring its subviews. This is not functional because each of these subviews performs a different action when activating it. I found that VoiceControl is only numbering subviews when the parent's isAccessibilityElement is set to NO. And indeed, when changing to NO, the subviews are getting numbered, but the custom actions group break, and VoiceOver treats each element as a separate accessibility element. So I can't use accessibilityCustomActions AND supporting VoiceControl. Is this an intended behavior defined by Apple? Or, is there anyway I can support them both?
0
1
558
Oct ’23
dispatch_once weird behavior
Hi! I have a xcode workspace with first objectiveC framework (let’s call it framework#1). This framework has some singletons (+(instancetype)shared using the dispatch_once idiom. This code is pretty straight forward and used everywhere : + (instancetype)shared { static dispatch_once_t onceToken; static OGAKeyManager *instance = nil; dispatch_once(&onceToken, ^{ instance = [[self alloc] init]; }); return instance; } I have a second framework (framework#2) in Swift that uses theses singletons (the framework#1 is added as do not embeed in the framework settings). And I have an application that uses both frameworks. If I make a breakpoint inside the dispatch_once alloc/init, I see that I enter 2 times : once when the shared method is called from framework#1 and another one when it’s called from framework#2. How is that even possible ? Isn't dispatch_once supposed to handle this ? I asked chatGPT, it points out to some objC/Swift interoperability, but honestly, I don't see what I can do to make it work correctly. There is no circular dependency (framwork#2 uses framwork#1, but framwork#1 has no clue of framwork#2 existence) Maybe it has something to do with sandbox, but I don't see how can it be. Does anyone experienced some weird behavior like this ? Thanks
7
0
1.6k
Sep ’23
how to use Live Acitivity in objective-c project?
I have a history objective-c project, and now i want to use Live Acitivity feature in that objc project. first i implement a live activity in swift project, and it works well on iphone devices. then i copy same codes from swift project to objective-c project, build and run on same iphone device, no error or warning generates, but Live Activity UI can't seen. can someone tell me how to fix it ? and only swift project can support Live Activity ?
1
1
828
Sep ’23
Dictionary objectForKey Crashing on Older Devices After Software Update
My apps were working fine and suddenly started crashing on older devices. I have iPhone 7 Plus to test and after updating it to 15.7.8, the installed apps which were working before started crashing. The specific code where they are crashing is if([testStats objectForKey:TEST_STATS_ARRAY]) { statArray = [testStats objectForKey:TEST_STATS_ARRAY]; } else { statArray = [[NSMutableArray alloc] init]; [testStats setValue:statArray forKey:TEST_STATS_ARRAY]; }
2
0
702
Aug ’23
objc: Class MyClass is implemented in both dylibs
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?
2
0
1.4k
Aug ’23
Check if my app has a new version on AppStore
I would like to manually check if there are new updates for my app while the user is in it, and prompt him to download the new version. Can I do this by checking the version of my app in the app store - programatically?I found a solution by Checking response of my app itunesRL, i want to confirm if there is an official method, if not can i use this methode safely.https://stackoverflow.com/questions/6256748/check-if-my-app-has-a-new-version-on-appstore
4
0
29k
Jul ’23
iOS 16 libobjc.A.dylib objc_release Crash
Hardware Model: iPhone12,8 Code Type: ARM-64 Parent Process: [1] Date/Time: 2023-05-14T09:24:05Z OS Version: iPhone OS 16.3.1 (20D67) Report Version: 104 Exception Type: SIGSEGV Exception Codes: SEGV_ACCERR at 0xd665cce30 Crashed Thread: 2 Thread 2 Crashed: 0 libobjc.A.dylib 0x00000001860db554 objc_release + 16 1 libsystem_blocks.dylib 0x00000001db1c9124 _call_dispose_helpers_excp + 48 2 libsystem_blocks.dylib 0x00000001db1c8d54 _Block_release + 248 3 libdispatch.dylib 0x000000019456cf88 _dispatch_client_callout + 16 4 libdispatch.dylib 0x0000000194574640 _dispatch_lane_serial_drain + 668 5 libdispatch.dylib 0x000000019457518c _dispatch_lane_invoke + 380 6 libdispatch.dylib 0x000000019457fe10 _dispatch_workloop_worker_thread + 648 7 libsystem_pthread.dylib 0x00000001db1ccdf8 _pthread_wqthread + 284 8 libsystem_pthread.dylib 0x00000001db1ccb98 start_wqthread + 4
2
0
3.7k
May ’23
Annoying documentation issue
I've been using Xcode and Objective-C for years, and rely heavily on the built-in documentation, which is for the most part good.There's an issue that's always bothered me. Today I was looking up a function called class_getName. I found its documentation page, and was also able to navigate to the page showing the overview of the runtime system, all of which is fine.When I typed "class_getName" into my program, the compiler immediately flagged it as an unknown symbol.I knew I probably had to include a header, but none of the documentation pages I looked at mentioned the name of the header file. I had to end up searching the internet for examples until I hit one that showed <objc/runtime.h> being imported.Why isn't this very small, simple and extremely useful bit of information included in the documentation?Frank
5
1
1.5k
May ’23
Will Apple start deprecating or stop supporting ObjectiveC?
I have developed a application for my client (product based company) in ObjectiveC for past 4 years. Now, looking at the progress that Swift is making, I am confused if I am being left behind. My mind is full of below question:Will Apple start deprecating or stop supporting ObjectiveC sooner or laterif Yes, how long from now (approx or any hint from Apple)Is it right time to start migrating or wait for couple of more Swift versionsStatistics about apps migrated/being migrated. How many apps are in ObjectiveC & SwiftAny pointers to above queries is highly appreciated. Thanks in advance.
4
0
3.7k
May ’23
Objective-C copy properties
When I have a property like this: @property (nonatomic, readonly, copy) NSURL *sourceURL; And then I call: NSURL *url = self.sourceURL; Assuming that ARC is disabled, to ensure this object does not leak, must I manually release url? If so, how come I don't have to with: NSURL *url = [NSURL URLWithString:@"http://www.apple.com"]; NSURL *absURL = url.absoluteURL; Despite the absoluteString property also being readonly and copy: As per Apple: @property(nullable, readonly, copy) NSURL *absoluteURL;
2
0
1.8k
Apr ’23
ARC and init
I heard that "Methods starting with init or new or containing copy transfer, by definition, ownership; all other methods do not. Does this apply to ALL methods with the word "init" in the name, even if the function is "initialCapitalizationMode", in which initial does not mean the same as init? Or does it only work if it has "init" and then an uppercase letter after the fact?
2
0
772
Apr ’23
Objective C's Sadness
Dear developers, I suddenly have a massive confusion about the undergoing big programming revolution inside apple developers. I understand swift has been officially announced since 2014. As a normal iOS mobile developer, I respect and follow all the new policy from apple. But I just had such thoughts and doubts: What makes Objective C so weak comparing to Swift? Is that because all the banks use Java as programming language? Is objective cannot easily access windows system? Is Swift wrapped with Objective C or Swift is totally a brand new programming language? How many new hardware interface have been available to access by accepting Swift? Is Objective C going to disappear within next 5 years? How many years will it take apple to stable its own programming language? NOTE: I met a lot of iOS mobile developers change to learn JAVA, Become an android developer. eg: https://developer.apple.com/library/ios/samplecode/Reachability/Introduction/Intro.html#//apple_ref/doc/uid/DTS40007324-Intro-DontLinkElementID_2 The sample code from apple documents was still written in Objective C @2016, Are we going to use Swift or Objective C? and some of the APIs documents are not completed, class initializer cannot be accessed such as https://developer.apple.com/library/tvos/documentation/SystemConfiguration/Reference/SCNetworkReachabilityRef/index.html#//apple_ref/doc/uid/TP40007260-CH101-SW4but was writted beautifully in apple documents.
1
0
1.1k
Mar ’23
iOS cpu/gpu/battery temperature readings
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!
Replies
4
Boosts
1
Views
7.8k
Activity
Oct ’23
objc4-818.2 object_cxxDestructFromClass implementation
Below is the implementation of the object_cxxDestructFromClass method. the line below the for loop if (!cls->hasCxxDtor()) return; Some questions: If a subclass inherits a parent class, and one of the middle classes does not have a CxxDtor, but the parent class does, will there be any problems with the release of the instance? static void object_cxxDestructFromClass(id obj, Class cls) { void (*dtor)(id); // Call cls's dtor first, then superclasses's dtors. for ( ; cls; cls = cls->getSuperclass()) { if (!cls->hasCxxDtor()) return; dtor = (void(*)(id)) lookupMethodInClassAndLoadCache(cls, SEL_cxx_destruct); if (dtor != (void(*)(id))_objc_msgForward_impcache) { if (PrintCxxCtors) { _objc_inform("CXX: calling C++ destructors for class %s", cls->nameForLogging()); } (*dtor)(obj); } } }
Replies
0
Boosts
0
Views
548
Activity
Oct ’23
Using VoiceOver's accessibilityCustomActions and supporting Voice Control for the group subviews
Hi, My app supports VoiceOver and VoiceControl, and I find it hard or perhaps even impossible to support both when it comes to grouping accessibility elements. I have an element containing multiple subviews, and I want to define it as a group of accessibility custom actions to enhance VoiceOver navigation. (So that the user can focus on the entire element, and just swipe up or down if they want to activate one of its subviews as a custom action). To do that, I'm setting isAccessibilityElement to YES and I'm using accessibilityCustomActions where I create a custom action for each of this element's subviews. This works fine and presents the accessibility custom actions as expected. The struggle comes when I try to combine it with Voice Control. Since the element contains multiple subviews, I want each of these subviews to be accessible when using Voice Control with item numbers, for example. Instead, Voice Control is setting a number only on the entire element, ignoring its subviews. This is not functional because each of these subviews performs a different action when activating it. I found that VoiceControl is only numbering subviews when the parent's isAccessibilityElement is set to NO. And indeed, when changing to NO, the subviews are getting numbered, but the custom actions group break, and VoiceOver treats each element as a separate accessibility element. So I can't use accessibilityCustomActions AND supporting VoiceControl. Is this an intended behavior defined by Apple? Or, is there anyway I can support them both?
Replies
0
Boosts
1
Views
558
Activity
Oct ’23
Xcode15 では、Google AdMob がBuild Failedになる
When building for iOS Simulator, the expected library /Users/////AdMob/FBLPromises.xcframework/ios-arm64_x86_64-simulator/FBLPromises.framework was not found in /Users/////AdMob/FBLPromises.xcframework
Replies
1
Boosts
0
Views
888
Activity
Sep ’23
dispatch_once weird behavior
Hi! I have a xcode workspace with first objectiveC framework (let’s call it framework#1). This framework has some singletons (+(instancetype)shared using the dispatch_once idiom. This code is pretty straight forward and used everywhere : + (instancetype)shared { static dispatch_once_t onceToken; static OGAKeyManager *instance = nil; dispatch_once(&onceToken, ^{ instance = [[self alloc] init]; }); return instance; } I have a second framework (framework#2) in Swift that uses theses singletons (the framework#1 is added as do not embeed in the framework settings). And I have an application that uses both frameworks. If I make a breakpoint inside the dispatch_once alloc/init, I see that I enter 2 times : once when the shared method is called from framework#1 and another one when it’s called from framework#2. How is that even possible ? Isn't dispatch_once supposed to handle this ? I asked chatGPT, it points out to some objC/Swift interoperability, but honestly, I don't see what I can do to make it work correctly. There is no circular dependency (framwork#2 uses framwork#1, but framwork#1 has no clue of framwork#2 existence) Maybe it has something to do with sandbox, but I don't see how can it be. Does anyone experienced some weird behavior like this ? Thanks
Replies
7
Boosts
0
Views
1.6k
Activity
Sep ’23
how to use Live Acitivity in objective-c project?
I have a history objective-c project, and now i want to use Live Acitivity feature in that objc project. first i implement a live activity in swift project, and it works well on iphone devices. then i copy same codes from swift project to objective-c project, build and run on same iphone device, no error or warning generates, but Live Activity UI can't seen. can someone tell me how to fix it ? and only swift project can support Live Activity ?
Replies
1
Boosts
1
Views
828
Activity
Sep ’23
Dictionary objectForKey Crashing on Older Devices After Software Update
My apps were working fine and suddenly started crashing on older devices. I have iPhone 7 Plus to test and after updating it to 15.7.8, the installed apps which were working before started crashing. The specific code where they are crashing is if([testStats objectForKey:TEST_STATS_ARRAY]) { statArray = [testStats objectForKey:TEST_STATS_ARRAY]; } else { statArray = [[NSMutableArray alloc] init]; [testStats setValue:statArray forKey:TEST_STATS_ARRAY]; }
Replies
2
Boosts
0
Views
702
Activity
Aug ’23
objc: Class MyClass is implemented in both dylibs
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?
Replies
2
Boosts
0
Views
1.4k
Activity
Aug ’23
Check if my app has a new version on AppStore
I would like to manually check if there are new updates for my app while the user is in it, and prompt him to download the new version. Can I do this by checking the version of my app in the app store - programatically?I found a solution by Checking response of my app itunesRL, i want to confirm if there is an official method, if not can i use this methode safely.https://stackoverflow.com/questions/6256748/check-if-my-app-has-a-new-version-on-appstore
Replies
4
Boosts
0
Views
29k
Activity
Jul ’23
DocC doesn't work for Objective-C static library
Hello! I have a static lib project in Objective-C, in the project I have set... Build Documentation During 'Build' -> Yes Build Multi-Language Documentation for Objective-C ony Targets -> Yes The documentation viewer opens after that, but the target is not present under Objective-C?
Replies
0
Boosts
0
Views
869
Activity
Jun ’23
iOS 16 libobjc.A.dylib objc_release Crash
Hardware Model: iPhone12,8 Code Type: ARM-64 Parent Process: [1] Date/Time: 2023-05-14T09:24:05Z OS Version: iPhone OS 16.3.1 (20D67) Report Version: 104 Exception Type: SIGSEGV Exception Codes: SEGV_ACCERR at 0xd665cce30 Crashed Thread: 2 Thread 2 Crashed: 0 libobjc.A.dylib 0x00000001860db554 objc_release + 16 1 libsystem_blocks.dylib 0x00000001db1c9124 _call_dispose_helpers_excp + 48 2 libsystem_blocks.dylib 0x00000001db1c8d54 _Block_release + 248 3 libdispatch.dylib 0x000000019456cf88 _dispatch_client_callout + 16 4 libdispatch.dylib 0x0000000194574640 _dispatch_lane_serial_drain + 668 5 libdispatch.dylib 0x000000019457518c _dispatch_lane_invoke + 380 6 libdispatch.dylib 0x000000019457fe10 _dispatch_workloop_worker_thread + 648 7 libsystem_pthread.dylib 0x00000001db1ccdf8 _pthread_wqthread + 284 8 libsystem_pthread.dylib 0x00000001db1ccb98 start_wqthread + 4
Replies
2
Boosts
0
Views
3.7k
Activity
May ’23
Annoying documentation issue
I've been using Xcode and Objective-C for years, and rely heavily on the built-in documentation, which is for the most part good.There's an issue that's always bothered me. Today I was looking up a function called class_getName. I found its documentation page, and was also able to navigate to the page showing the overview of the runtime system, all of which is fine.When I typed "class_getName" into my program, the compiler immediately flagged it as an unknown symbol.I knew I probably had to include a header, but none of the documentation pages I looked at mentioned the name of the header file. I had to end up searching the internet for examples until I hit one that showed <objc/runtime.h> being imported.Why isn't this very small, simple and extremely useful bit of information included in the documentation?Frank
Replies
5
Boosts
1
Views
1.5k
Activity
May ’23
Will Apple start deprecating or stop supporting ObjectiveC?
I have developed a application for my client (product based company) in ObjectiveC for past 4 years. Now, looking at the progress that Swift is making, I am confused if I am being left behind. My mind is full of below question:Will Apple start deprecating or stop supporting ObjectiveC sooner or laterif Yes, how long from now (approx or any hint from Apple)Is it right time to start migrating or wait for couple of more Swift versionsStatistics about apps migrated/being migrated. How many apps are in ObjectiveC & SwiftAny pointers to above queries is highly appreciated. Thanks in advance.
Replies
4
Boosts
0
Views
3.7k
Activity
May ’23
Objective-C copy properties
When I have a property like this: @property (nonatomic, readonly, copy) NSURL *sourceURL; And then I call: NSURL *url = self.sourceURL; Assuming that ARC is disabled, to ensure this object does not leak, must I manually release url? If so, how come I don't have to with: NSURL *url = [NSURL URLWithString:@"http://www.apple.com"]; NSURL *absURL = url.absoluteURL; Despite the absoluteString property also being readonly and copy: As per Apple: @property(nullable, readonly, copy) NSURL *absoluteURL;
Replies
2
Boosts
0
Views
1.8k
Activity
Apr ’23
ARC and init
I heard that "Methods starting with init or new or containing copy transfer, by definition, ownership; all other methods do not. Does this apply to ALL methods with the word "init" in the name, even if the function is "initialCapitalizationMode", in which initial does not mean the same as init? Or does it only work if it has "init" and then an uppercase letter after the fact?
Replies
2
Boosts
0
Views
772
Activity
Apr ’23
How to debug unrecognized selector error - newTextureWithDescriptor:iosurface:plane?
(deleted)
Replies
0
Boosts
0
Views
804
Activity
Mar ’23
How to reboot from Objective-C?
I want to reboot from an Objective-C program.
Replies
9
Boosts
0
Views
1.7k
Activity
Mar ’23
Objective C's Sadness
Dear developers, I suddenly have a massive confusion about the undergoing big programming revolution inside apple developers. I understand swift has been officially announced since 2014. As a normal iOS mobile developer, I respect and follow all the new policy from apple. But I just had such thoughts and doubts: What makes Objective C so weak comparing to Swift? Is that because all the banks use Java as programming language? Is objective cannot easily access windows system? Is Swift wrapped with Objective C or Swift is totally a brand new programming language? How many new hardware interface have been available to access by accepting Swift? Is Objective C going to disappear within next 5 years? How many years will it take apple to stable its own programming language? NOTE: I met a lot of iOS mobile developers change to learn JAVA, Become an android developer. eg: https://developer.apple.com/library/ios/samplecode/Reachability/Introduction/Intro.html#//apple_ref/doc/uid/DTS40007324-Intro-DontLinkElementID_2 The sample code from apple documents was still written in Objective C @2016, Are we going to use Swift or Objective C? and some of the APIs documents are not completed, class initializer cannot be accessed such as https://developer.apple.com/library/tvos/documentation/SystemConfiguration/Reference/SCNetworkReachabilityRef/index.html#//apple_ref/doc/uid/TP40007260-CH101-SW4but was writted beautifully in apple documents.
Replies
1
Boosts
0
Views
1.1k
Activity
Mar ’23
Is objective -c deprecated ?
Is objective -c deprecated ? Apple support is available ?
Replies
2
Boosts
0
Views
1.4k
Activity
Mar ’23
Don't show "Backgound Item Added" notification
Hello all, I am working on an application which will work as daemon for the user. With the update to Ventura I have seen that notification when daemons are installed is displayed. is there any way to add code to prevent that notification to show up? Thanks!
Replies
2
Boosts
0
Views
820
Activity
Mar ’23