DatePicker always get timeFormat from device setting, but i need to show time in datePicker based on My app setting not device setting. any solution for this problem
I tried to set locale "us_POSIX" locale for 12 hour and "us_GB" for 24 hour format this way is work in gregorian calendar , but in japanese calendar not showing year properly like (picker showing " 6 " instead of " Reiwa 6 " )
Objective-C Runtime
RSS for tagThe Objective-C runtime is a runtime library that supports the dynamic properties of the Objective-C language.
Posts under Objective-C Runtime tag
27 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
I used a custom time format in the DateTimePicker, such as 'hh:mm a' for 12-hour format. Although the device's time format is set to 24-hour mode, my sample app displays time in 24-hour format like '23:10' instead of the desired 12-hour format like '11:10 PM'.
I've already set the locale for the 12-hour format. Has anyone else encountered this issue, and what could be the solution?
Hi. We have weird trouble related to the multi-threading.
Does anyone have ideas how to resolve or avoid?
Sample Code
// sample.hpp
class Sample {
public:
Sample();
~Sample();
void Init();
void Dealloc();
void OnEvent();
private:
std::mutex sample_mutex_;
int counter = 1;
}
// sample.cpp
#include "sample.hpp"
Sample::Sample() {}
Sample::~Sample() {}
void Sample::Init() {
std::async([]() {
std::this_thread::sleep_for(std::chrono::seconds(2));
this->OnEvent();
});
}
void Sample::Dealloc() {
std::lock_guard<std::mutex> lock(sample_mutex_);
counter = 0;
}
void Sample::OnEvent {
// called from another thread
std::lock_guard<std::mutex> lock(sample_mutex_);
counter += 1;
}
// obj_sample.h
@interface ObjSample : NSObject
- (id _Nonnull)init;
@property(nonatomic, readonly) std::shared_ptr<Sample> sample;
@end
// obj_sample.mm
@implementation ObjSample
- (id _Nonnull)init{
if (self = [super init]) {
_sample = std::make_shared<Sample>();
_sample->Init();
}
return self;
}
- (void)dealloc {
sample->Dealloc();
}
@end
What happens
the deadlock happens.
according to the debug navigator with the Xcode, we figured out 2 facts below.
OnEvent does not end although it looks completed.
void Sample::OnEvent {
// called from another thread
std::lock_guard<std::mutex> lock(sample_mutex_);
counter += 1;
} // <= Thread 35: stop here
Sample::Dealloc is run on the same thread of OnEvent.
// debug navigator
Thread 35
2 Sample::Dealloc <- this is weird.
3 Sample::OnEvent
We guess they causes the deadlock.
probability
less than 10%
Environment
MacOS: 14.3.1(Apple M1)
Xcode: 15.3
iOS Simulator: 17.0.1
Intermittent Failures Occur During macOS Build Execution on Bamboo. Below is an Extract from the Failure Logs.
Note: Please note that within our larger Bamboo build environment, several Xcode projects are constructed. Failures occur intermittently across various Xcode projects each time the Bamboo build is initiated. Therefore, these failures are not specific to any particular Xcode project. It's important to emphasize that the Xcode project mentioned, "myProject.xcodeproj," is used purely as a placeholder or example in this context.
which 'xcodebuild' VALID_ARCHS="x86_64 arm64" ARCHS="x86_64" -project “”myProject.xcodeproj"" -alltargets -configuration "Release" -UseModernBuildSystem=NO
build 08-Feb-2024 09:53:00 Command line invocation:
build 08-Feb-2024 09:53:00 /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild "VALID_ARCHS=x86_64 arm64" ARCHS=x86_64 -project myProject.xcodeproj -alltargets -configuration Release -UseModernBuildSystem=NO
build 08-Feb-2024 09:53:00
build 08-Feb-2024 09:53:00 User defaults from command line:
build 08-Feb-2024 09:53:00 IDEPackageSupportUseBuiltinSCM = YES
build 08-Feb-2024 09:53:00 UseModernBuildSystem = NO
build 08-Feb-2024 09:53:00
build 08-Feb-2024 09:53:00 Build settings from command line:
build 08-Feb-2024 09:53:00 ARCHS = x86_64
build 08-Feb-2024 09:53:00 VALID_ARCHS = x86_64 arm64
build 08-Feb-2024 09:53:00
error 08-Feb-2024 09:53:01 objc[39076]: thread is already initializing this class!
error 08-Feb-2024 09:53:01 make[6]: *** [compile] Abort trap: 6
I'm working on an FFI for working with ObjectiveC/Foundation/Metal. AFAIU, as many APIs create and autorelease objects, I need to ensure that an NSAutoreleasePool is active when calling into these APIs. So I've created a wrapper that basically mimics @autoreleasepool by creating and initializing an NSAutoreleasePool, running some code, and then draining the pool. So far so good; I'm using this functionality around most of my entry points into the ObjectiveC world.
There's two issues I don't understand though. The first is that NSAutoreleasePool initialization seems to require an active autorelease pool, which seems like a chicken-and-egg problem. Running with OBJC_DEBUG_MISSING_POOLS=YES and breaking on objc_autoreleaseNoPool, I see:
objc[30336]: MISSING POOLS: (0x1e2e89c40) Object 0x6000007e0050 of class __NSCFString autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug
(lldb) bt
objc_autoreleaseNoPool at /usr/lib/libobjc.A.dylib (unknown line)
_ZN19AutoreleasePoolPage17autoreleaseNoPageEP11objc_object at /usr/lib/libobjc.A.dylib (unknown line)
_ZN19AutoreleasePoolPage4pushEv at /usr/lib/libobjc.A.dylib (unknown line)
_CFAutoreleasePoolPush at /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (unknown line)
-[NSAutoreleasePool init] at /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (unknown line)
macro expansion at /Users/tim/Julia/pkg/ObjectiveC/src/syntax.jl:163 [inlined]
NSAutoreleasePool at /Users/tim/Julia/pkg/ObjectiveC/src/foundation.jl:427
The second, related problem is that some APIs that are called by Metal from a background thread I don't control:
(lldb) bt
* thread #11, queue = 'com.Metal.CompletionQueueDispatch', stop reason = breakpoint 1.1
* frame #0: 0x000000018c21b9e8 libobjc.A.dylib`objc_autoreleaseNoPool
frame #1: 0x000000018c1eb99c libobjc.A.dylib`AutoreleasePoolPage::autoreleaseNoPage(objc_object*) + 252
frame #2: 0x000000018c21c9ec libobjc.A.dylib`AutoreleasePoolPage::push() + 76
frame #3: 0x00000001aaef9694 IOGPU`-[IOGPUMetalBuffer dealloc] + 104
frame #4: 0x00000001f83554e4 AGXMetalG15X_B0`-[AGXBuffer dealloc] + 44
frame #5: 0x00000001f837eb98 AGXMetalG15X_B0`-[AGXG15XFamilyBuffer dealloc] + 76
frame #6: 0x000000019687c1c4 Metal`MTLResourceListChunkFreeEntries(MTLResourceListChunk*) + 64
frame #7: 0x000000019674e2b0 Metal`-[MTLResourceList releaseAllObjectsAndReset] + 72
frame #8: 0x00000001aaefbd10 IOGPU`IOGPUMetalCommandBufferStorageReset + 36
frame #9: 0x00000001aaefbcac IOGPU`IOGPUMetalCommandBufferStorageDealloc + 76
frame #10: 0x00000001aaefa130 IOGPU`-[IOGPUMetalCommandBuffer didCompleteWithStartTime:endTime:error:] + 240
frame #11: 0x000000019674dce4 Metal`-[_MTLCommandQueue commandBufferDidComplete:startTime:completionTime:error:] + 108
frame #12: 0x00000001aaf03b54 IOGPU`IOGPUNotificationQueueDispatchAvailableCompletionNotifications + 128
frame #13: 0x00000001aaf03c60 IOGPU`__IOGPUNotificationQueueSetDispatchQueue_block_invoke + 64
frame #14: 0x000000018c4049d0 libdispatch.dylib`_dispatch_client_callout4 + 20
frame #15: 0x000000018c420c5c libdispatch.dylib`_dispatch_mach_msg_invoke + 468
frame #16: 0x000000018c40bd28 libdispatch.dylib`_dispatch_lane_serial_drain + 368
frame #17: 0x000000018c421998 libdispatch.dylib`_dispatch_mach_invoke + 444
frame #18: 0x000000018c40bd28 libdispatch.dylib`_dispatch_lane_serial_drain + 368
frame #19: 0x000000018c40ca08 libdispatch.dylib`_dispatch_lane_invoke + 432
frame #20: 0x000000018c40bd28 libdispatch.dylib`_dispatch_lane_serial_drain + 368
frame #21: 0x000000018c40c9d4 libdispatch.dylib`_dispatch_lane_invoke + 380
frame #22: 0x000000018c41761c libdispatch.dylib`_dispatch_root_queue_drain_deferred_wlh + 288
frame #23: 0x000000018c416e90 libdispatch.dylib`_dispatch_workloop_worker_thread + 404
frame #24: 0x000000018c5b2114 libsystem_pthread.dylib`_pthread_wqthread + 288
(lldb) c
Process 26902 resuming
objc[26902]: MISSING POOLS: (0x1e2e89c40) Object 0x14c8a2400 of class AGXG15SDevice autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug
Again, I'm not sure how I'm supposed to run this under an autorelease pool.
My application is currently crashing in production in iPhone devices running iOS 15.x. The app will work as normal while running developer mode, enterprise builds and Test Flight builds. Unfortunately, I am unable to reproduce this issue even app is downloaded from the app store.
I observed crash is happening at main.m.
Can someone help me to reproduce this issue?
How to read this crash log file?
Please find the crash log details attached.
2022-03-04_14-15-23.6227_+0900-a1899fd803a4ed683466702be71b9d224b4cd5bc.crash
I'm unable to run my app with ASAN enabled when targeting a physical iOS device. Simulator targets do work.
With Xcode 12 and an iPad mini 4 running iOS 14 beta 1 I get the following error during app launch
==750==ERROR: AddressSanitizer failed to allocate 0xffffffffff9fc000 (-6307840) bytes at address 2db624000 (errno: 22)
==750==ReserveShadowMemoryRange failed while trying to map 0xffffffffff9fc000 bytes. Perhaps you're using ulimit -v With Xcode 11.5 and an iPad Air 2 running OS 12.4.1 the error is
==2177==Unable to find a memory range after restricting VM.
==2177==AddressSanitizer CHECK failed: /BuildRoot/Library/Caches/com.apple.xbs/Sources/clangcompilerrt/clang-1103.0.32.62/compiler-rt/lib/asan/asanmac.cc:92 "((0 &amp;&amp; "cannot place shadow after restricting vm")) != (0)" (0x0, 0x0)
&lt;empty stack&gt;==2177==AddressSanitizer CHECK failed: /BuildRoot/Library/Caches/com.apple.xbs/Sources/clangcompilerrt/clang-1103.0.32.62/compiler-rt/lib/asan/../sanitizercommon/sanitizermallocmac.inc:143 "((!asaninitisrunning)) != (0)" (0x0, 0x0)
warning: could not execute support code to read Objective-C class data in the process. This may reduce the quality of type information available.
AddressSanitizer report breakpoint hit. Use 'thread info -s' to get extended information about the report.
(lldb) thread info -s
thread #1: tid = 0x1076c2, 0x000000011531e984 libclangrt.asaniosdynamic.dylib`__asan::AsanDie() My coworker is able to use ASAN with the same App using iPad Pro 10.5, iPadOS 13.5.1, Xcode 11.5
Are there any configuration changes I need to make to be able to use ASAN on my devices?