iOS main函数参数的一点解读

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)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 206,214评论 6 481
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 88,307评论 2 382
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 152,543评论 0 341
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 55,221评论 1 279
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 64,224评论 5 371
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 49,007评论 1 284
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,313评论 3 399
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,956评论 0 259
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 43,441评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,925评论 2 323
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,018评论 1 333
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,685评论 4 322
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,234评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,240评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,464评论 1 261
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,467评论 2 352
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,762评论 2 345

推荐阅读更多精彩内容

  • two Last login: Tue Aug 4 17:09:57 on ttys000 yushengyang...
    aofeilin阅读 1,026评论 1 9
  • 首先如果遇到应用卡顿或者因为内存占用过多时一般使用Instruments里的来进行检测。但对于复杂情况可能就需要用...
    攻克乃还_阅读 1,815评论 0 7
  • 放一篇之前一直在私人笔记里的参考,也就是个参考手册,用到的时候回来看看。 ‘$’ 作为引用关键字 ex:$PROJ...
    SMThree阅读 3,823评论 0 13
  • 你别问我为什么从不见你 你听 秋天从来不会歌唱 有人赞春 有人迷冬 而我在夏秋之中 选择了枯萎 枯萎我的容颜 枯萎...
    隅川阅读 643评论 2 3
  • 美丽的深秋
    张润润阅读 148评论 0 1