https://developer.apple.com/documentation/uikit/uibutton/1624028-buttonwithtype?language=objc
Discussion
This method is a convenience constructor for creating button objects with specific configurations. If you subclass UIButton, this method does not return an instance of your subclass. If you want to create an instance of a specific subclass, you must alloc/init the button directly.
My test:
@interface MyButton : UIButton
@end
@implementation MyButton
@end
test output:
NSLog(@"%@", NSStringFromClass([MyButton buttonWithType:UIButtonTypeCustom].class));
output:
MyButton
the document is old or wrong ?
Post
Replies
Boosts
Views
Activity
Build for release
Xcode version 14.3
launch on iOS 13.6
log
{"app_cohort":"2|date=1680174000000&sf=143441&tid=e41c65db43313258cf184d5608cdcc841480dcd8fe87718b212f9c3f10d6f146&ttype=i","app_name":"myApp","app_version":"1.10.0","timestamp":"2023-03-30 19:24:36.00 +0800","slice_uuid":"7a485574-1c6d-307d-b432-48a794dace50","adam_id":1039749242,"build_version":"2303301","bundleID":"com.myApp","share_with_app_devs":0,"is_first_party":0,"bug_type":"109","os_version":"iPhone OS 13.6 (17G68)","incident_id":"937E7410-DD2F-4494-BF73-AC0EEFFA0A0B","name":"myApp","is_beta":1}
Incident Identifier: 937E7410-DD2F-4494-BF73-AC0EEFFA0A0B
Beta Identifier: 8D1CE473-6B17-4B99-9780-8D7C94C9A2F9
Hardware Model: iPhone8,1
Process: myApp [2748]
Path: /private/var/containers/Bundle/Application/46C86A3C-40BF-4E81-AA72-7DCE695E9CEA/myApp.app/myApp
Identifier: com.myApp
Version: 2303301 (1.10.0)
AppStoreTools: 14E221
AppVariant: 1:iPhone8,1:13
Beta: YES
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: com.myApp [803]
Date/Time: 2023-03-30 19:24:36.7597 +0800
Launch Time: 2023-03-30 19:24:35.6722 +0800
OS Version: iPhone OS 13.6 (17G68)
Release Type: User
Baseband Version: 7.70.01
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Description: DYLD, Assertion failed: (gotLocation), function applyFixupsToImage_block_invoke_3, file /Library/Caches/com.apple.xbs/Sources/dyld/dyld-750.4.2/dyld3/Loading.cpp, line 779.
Highlighted by Thread: 0
Backtrace not available
Unknown thread crashed with ARM Thread State (64-bit):
x0: 0x0000000000000006 x1: 0x0000000000000009 x2: 0x000000016efa3f10 x3: 0x0000000000000014
x4: 0x000000016efa3b10 x5: 0x0000000000000000 x6: 0x000000016efa4890 x7: 0x000000016efa49a8
x8: 0x0000000000000020 x9: 0x0000000000000009 x10: 0x2e342e3035372d64 x11: 0x2f33646c79642f32
x12: 0x2f33646c79642f32 x13: 0x2e676e6964616f4c x14: 0x6e696c202c707063 x15: 0x000a2e3937372065
x16: 0x0000000000000209 x17: 0x0000000000000053 x18: 0x0000000000000000 x19: 0x0000000000000000
x20: 0x000000016efa3b10 x21: 0x0000000000000014 x22: 0x000000016efa3f10 x23: 0x0000000000000009
x24: 0x0000000000000006 x25: 0x0000000000008fa4 x26: 0x00000000000072dd x27: 0x00000001033c1934
x28: 0x0000000001f27380 fp: 0x000000016efa3ae0 lr: 0x00000001032d3ee8
sp: 0x000000016efa3aa0 pc: 0x00000001032ccf68 cpsr: 0x40000000
esr: 0x00000000 Address size fault
Binary images description not available
Error Formulating Crash Report:
Failed to create CSSymbolicatorRef - corpse still valid ¯\_(ツ)_/¯
EOF
See details: https://github.com/Tencent/wcdb/issues/971
Xcode 14.3.1 is ok
Thread 1 Queue : com.apple.main-thread (serial)
#0 0x0000000000000000 in 0x00000000 ()
#1 0x0000000106fb5f98 in _GLOBAL__sub_I_SyntaxCommonConst.cpp ()
#2 0x000000010a44b2c4 in ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) ()
#3 0x000000010a44b6b0 in ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) ()
#4 0x000000010a4460f0 in ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) ()
#5 0x000000010a444520 in ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) ()
#6 0x000000010a4445e8 in ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) ()
#7 0x000000010a436658 in dyld::initializeMainExecutable() ()
#8 0x000000010a43aeb0 in dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) ()
#9 0x000000010a435208 in dyldbootstrap::start(dyld3::MachOLoaded const*, int, char const**, dyld3::MachOLoaded const*, unsigned long*) ()
#10 0x000000010a435038 in _dyld_start ()
Thread 2Thread 3com.apple.CoreMotion.MotionThread (4)