美文网首页
iOS main函数参数的一点解读

iOS main函数参数的一点解读

作者: FancyH | 来源:发表于2018-08-28 12:37 被阅读0次

iOS main函数的一些知识,对于这个函数始终有一些神秘感,究其原因,我想大概他的那两个参数是脱不了干系的,于是我决定放手撕开一些的面纱,暴力处理一下:

    for(inti =0; i <200; i ++) {        printf(" %d  argv = %s\n",i, argv[i]); }

而结果确实是,收获颇丰..

我得到了如下log 


 0  argv = /Users/Alesary/Library/Developer/CoreSimulator/Devices/F14599E0-C985-45CE-BBDB-BDE856C84A20/data/Containers/Bundle/Application/7ECAF1D6-4AB4-4CCD-AD99-B4C264FA71DD/main_demo.app/main_demo

 1  argv = (null)

 2  argv = DYLD_FRAMEWORK_PATH=/Users/Alesary/Desktop/testDemo/main_demo/Build/Products/Debug-iphonesimulator

 3  argv = TMPDIR=/Users/Alesary/Library/Developer/CoreSimulator/Devices/F14599E0-C985-45CE-BBDB-BDE856C84A20/data/Containers/Data/Application/92E2F877-397A-4E40-80BE-184BA744D373/tmp

 4  argv = SQLITE_ENABLE_THREAD_ASSERTIONS=1

 5  argv = HOME=/Users/Alesary/Library/Developer/CoreSimulator/Devices/F14599E0-C985-45CE-BBDB-BDE856C84A20/data/Containers/Data/Application/92E2F877-397A-4E40-80BE-184BA744D373

 6  argv = __XPC_DYLD_FRAMEWORK_PATH=/Users/Alesary/Desktop/testDemo/main_demo/Build/Products/Debug-iphonesimulator

 7  argv = OS_ACTIVITY_DT_MODE=YES

 8  argv = SIMULATOR_VERSION_INFO=CoreSimulator 518.22 - Device: iPhone 8 Plus - Runtime: iOS 11.4 (15F79) - DeviceType: iPhone 8 Plus

 9  argv = SIMULATOR_UDID=F14599E0-C985-45CE-BBDB-BDE856C84A20

 10  argv = SIMULATOR_MAINSCREEN_SCALE=3.000000

 11  argv = SIMULATOR_EXTENDED_DISPLAY_PROPERTIES=/Users/Alesary/Library/Developer/CoreSimulator/Devices/F14599E0-C985-45CE-BBDB-BDE856C84A20/data/Library/Application Support/Simulator/extended_display.plist

 12  argv = SIMULATOR_DEVICE_NAME=iPhone 8 Plus

 13  argv = SIMULATOR_AUDIO_SETTINGS_PATH=/Users/Alesary/Library/Developer/CoreSimulator/Devices/F14599E0-C985-45CE-BBDB-BDE856C84A20/data/var/run/simulatoraudio/audiosettings.plist

 14  argv = CFFIXED_USER_HOME=/Users/Alesary/Library/Developer/CoreSimulator/Devices/F14599E0-C985-45CE-BBDB-BDE856C84A20/data/Containers/Data/Application/92E2F877-397A-4E40-80BE-184BA744D373

 15  argv = DYLD_FALLBACK_LIBRARY_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib

 16  argv = SIMULATOR_RUNTIME_VERSION=11.4

 17  argv = SIMULATOR_PRODUCT_CLASS=D21

 18  argv = SIMULATOR_MODEL_IDENTIFIER=iPhone10,5

 19  argv = SIMULATOR_MAINSCREEN_WIDTH=1242

 20  argv = SIMULATOR_MAINSCREEN_PITCH=461.000000

 21  argv = SIMULATOR_LEGACY_ASSET_SUFFIX=iphone

 22  argv = SIMULATOR_CAPABILITIES=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/DeviceTypes/iPhone 8 Plus.simdevicetype/Contents/Resources/capabilities.plist

 23  argv = SIMULATOR_BOOT_TIME=1535427993

 24  argv = IPHONE_TVOUT_EXTENDED_PROPERTIES=/Users/Alesary/Library/Developer/CoreSimulator/Devices/F14599E0-C985-45CE-BBDB-BDE856C84A20/data/Library/Application Support/Simulator/extended_display.plist

 25  argv = IPHONE_SHARED_RESOURCES_DIRECTORY=/Users/Alesary/Library/Developer/CoreSimulator/Devices/F14599E0-C985-45CE-BBDB-BDE856C84A20/data

 26  argv = __XPC_DYLD_LIBRARY_PATH=/Users/Alesary/Desktop/testDemo/main_demo/Build/Products/Debug-iphonesimulator

 27  argv = NSUnbufferedIO=YES

 28  argv = CUPS_SERVER=/private/tmp/com.apple.launchd.s9zkYscz34/Listeners

 29  argv = SIMULATOR_ROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot

 30  argv = SIMULATOR_HOST_HOME=/Users/Alesary

 31  argv = PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/bin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/sbin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/sbin:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/local/bin

 32  argv = DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot

 33  argv = XPC_SERVICE_NAME=UIKitApplication:HL.main-demo[0xd90f][8044]

 34  argv = DYLD_FALLBACK_FRAMEWORK_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks

 35  argv = __XCODE_BUILT_PRODUCTS_DIR_PATHS=/Users/Alesary/Desktop/testDemo/main_demo/Build/Products/Debug-iphonesimulator

 36  argv = RWI_LISTEN_SOCKET=/private/tmp/com.apple.launchd.3yrKAF0KIO/com.apple.webinspectord_sim.socket

 37  argv = CLASSIC=0

 38  argv = SIMULATOR_RUNTIME_BUILD_VERSION=15F79

 39  argv = SIMULATOR_LOG_ROOT=/Users/Alesary/Library/Logs/CoreSimulator/F14599E0-C985-45CE-BBDB-BDE856C84A20

 40  argv = SIMULATOR_AUDIO_DEVICES_PLIST_PATH=/Users/Alesary/Library/Developer/CoreSimulator/Devices/F14599E0-C985-45CE-BBDB-BDE856C84A20/data/var/run/com.apple.coresimulator.audio.plist

 41  argv = IOS_SIMULATOR_SYSLOG_SOCKET=/private/tmp/com.apple.CoreSimulator.SimDevice.F14599E0-C985-45CE-BBDB-BDE856C84A20/syslogsock

 42  argv = TESTMANAGERD_SIM_SOCK=/private/tmp/com.apple.launchd.0CuIZFdcpR/com.apple.testmanagerd.unix-domain.socket

 43  argv = SIMULATOR_MEMORY_WARNINGS=/Users/Alesary/Library/Developer/CoreSimulator/Devices/F14599E0-C985-45CE-BBDB-BDE856C84A20/data/var/run/memory_warning_simulation

 44  argv = SIMULATOR_MAINSCREEN_HEIGHT=2208

 45  argv = SIMULATOR_HID_SYSTEM_MANAGER=/Library/Developer/PrivateFrameworks/CoreSimulator.framework/Resources/Platforms/iphoneos/Library/Frameworks/SimulatorHID.framework

 46  argv = IPHONE_SIMULATOR_ROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot

 47  argv = XPC_FLAGS=0x0

 48  argv = DYLD_LIBRARY_PATH=/Users/Alesary/Desktop/testDemo/main_demo/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection

 49  argv = XPC_SIMULATOR_LAUNCHD_NAME=com.apple.CoreSimulator.SimDevice.F14599E0-C985-45CE-BBDB-BDE856C84A20

 50  argv = SIMULATOR_SHARED_RESOURCES_DIRECTORY=/Users/Alesary/Library/Developer/CoreSimulator/Devices/F14599E0-C985-45CE-BBDB-BDE856C84A20/data

 51  argv = (null)

 52  argv = (null)

 53  argv = executable_path=/Users/Alesary/Library/Developer/CoreSimulator/Devices/F14599E0-C985-45CE-BBDB-BDE856C84A20/data/Containers/Bundle/Application/7ECAF1D6-4AB4-4CCD-AD99-B4C264FA71DD/main_demo.app/main_demo

 54  argv = pfz=0x7ffffff81000

 55  argv = MallocNanoZone=1

 56  argv = 

 57  argv = 

 58  argv = main_stack=

 59  argv = executable_file=0x1801000004,0x201406737

 60  argv = dyld_file=0x1801000004,0x2010b5e7d

 61  argv = executable_cdhash=f49b276222e0b164e97b830d570534aac84424f4

 62  argv = (null)

相关文章

  • iOS main函数参数的一点解读

    iOS main函数的一些知识,对于这个函数始终有一些神秘感,究其原因,我想大概他的那两个参数是脱不了干系的,于是...

  • iOS 事件传递机制和响应者链条

    iOS中加载的时候会先执行main函数 根据main函数的参数加载UIApplication->AppDelega...

  • flutter pushname使用和多参数传递

    配置routes参数 main函数: 使用 单参数 多参数 参考了:Flutter命名路由及传参的深度实践与解读[...

  • int main(int argc, char* argv[])

    main函数的参数,经常用的main函数都是不带参数的。因此main后的括号都是空括号。实际上,main函数可以带...

  • iOS main函数知多少

    iOS main函数 一个 iOS App 的 main 函数位于 main.m 中,这是我们熟知的程序入口。但对...

  • 进程环境

    main函数 进程的执行是从main函数开始的,下面介绍一下main函数的原型。 可以看到main函数是有两个参数...

  • 关于main函数

    关于main函数 一般我们见到的main函数如下形式: 对main()函数不能由其它函数调用和传递参数,只能在程序...

  • C语言深度总结[全面认识main函数传递参数]

    关于main(int argc, char *argv[])参数传递 argc和argv是main函数的形式参数。...

  • iOS之UIView

    初识iOS APP开发#### 在iOS APP开发中, main函数仍是程序的入口和出口, 但main函数不需要...

  • 001-Objective-C基本语法

    基本语法 大体与 C 相同,包括 main 函数作为入口函数,main 函数的 int 和 char 数组参数,分...

网友评论

      本文标题:iOS main函数参数的一点解读

      本文链接:https://www.haomeiwen.com/subject/tomfwftx.html