How to avoid characters and source paths in iOS binary format?

When I compile the release version of my iOS application (based on the standard Apple proposed iOS application template), look at the resulting binary executable, I see all kinds of characters and even local sources of cpp source code and headers. I am very surprised why this is (I did not enable RTTI *). Especially the paths to the source files make me uncomfortable sending this application around the world (why should everyone see the layout of the catalog of my development machine?).

Here are two (randomly selected, moderate) excerpts:

TS/../ACTORS/CActorCanvasCharPart.cpplastMeshcapVerticesOFF BOUNDSupload VERTICES: %d 20CActorCanvasCharPartgrassscrub/Volumes/Data/iOS_projects/code/MyAppName_proj/MyAppName/source/STATES/GAMES/2/CStateGame2_grass.cppbaseShadowmowerstartmowerloopmowermowerCharcutGrassChargrassStuffgrassParticles/Volumes/Data/iOS_projects/code/MyAppName_proj/MyAppName/source/STATES/GAMES/2/CStateGame2_grass.h17CStateGame2_grasssinwriteStroke/Volumes/Data/iOS_projects/code/MyAppName_proj/MyAppName/source/STATES/GAMES/2/CStateGame2_flowers.hflowerBedsandTrailclickstart3inplace2sandDrag/Volumes/Data/iOS_projects/code/MyAppName_proj/MyAppName/source/STATES/GAMES/2/CStateGame

And there are a lot of characters for self-defined types and structures:

CAssetMgr="_vptr$CMgrBase"^^?"pMain"^{CMain}"inited"B"curveCount"S"curveSpecs"^{CCurveSpec}"gameSpecs"[23{CGameStateSpec="header"{SpecDiskHeader="type"i"version"S}"gameID"C"backgroundColor"{CRGBAcolorf="r"f"g"f"b"f"a"f}"clickPointColor"{CRGBAcolorf="r"f"g"f"b"f"a"f}"clickPointIconColor"{CRGBAcolorf="r"f"g"f"b"f"a"f}"hintColor"{CRGBAcolorf="r"f"g"f"b"f"a"f}}]"currentFont"^{CCharset}"userCharParts"^^{CCharPart}"words"{CDataSet<CName4,CCharArray>="_vptr$CObjectBase"^^?"pMain"^{CMain}"count"i"data"*"dataSize"l}"sets"{CDataSet<CName16,CCharArray>="_vptr$CObjectBase"^^?"pMain"^{CMain}"count"i"data"*"dataSize"l

Can this be avoided, how?

* UPDATE: I just found out that RTTI is enabled by default. So I cleared the target, disabled RTTI (GCC_ENABLE_CPP_RTTI = NO) and recompiled. I still see many characters and source paths in binary format.

UPDATE 2: I checked several other applications from the application store, and many of them also have paths to the source files. It's pretty scary if you ask me:

Joined Up Lite
/Users/lloydy/Documents/Development/iPhone/ABC Joined Up/main.m
/Users/lloydy/Documents/Development/iPhone/ABC Joined Up/Classes/SettingsView.m

Crayon Physics
/Users/smproot/Desktop/unzip/CrayonPhysics/v104/Classes/crayon/src/ceng/gameutils/killspriteslowly/killspriteslowly.cpp
/Users/smproot/Desktop/unzip/CrayonPhysics/v104/Classes/crayon/src/ceng/tasks/task/sdl/mixer/ctaskaudiosdlmixer.cpp

Wall Times
/Users/fred/_WORK/ZDNDRP/WallTimes/main.m
/Users/fred/_WORK/ZDNDRP/WallTimes/Classes/SystemCategories.m

Jumbo Calculator
/Users/Christopher/Documents/Development/JumboCalculator 1.0.3/main.m
/Users/Christopher/Documents/Development/JumboCalculator 1.0.3/Classes/CalculatorFaceViewController.m

+7
source share
4 answers

The file paths are most likely from the assert macros that build __FILE__ as part of the error message. The implementation of iOS assert(3) is performed by iOS, as are the NSAssert macros.

You can remove claims in releases by specifying NDEBUG (for statements C) and NS_BLOCK_ASSERTIONS (for NSAsserts).

+4
source

In Xcode, set Deployment Prostprocessing to Yes to invoke Xcode to invoke the strip command during the build process. Then you do not see any path to the source through nm -a.

However, I still see the source paths of some m files through the strings command: /

+4
source

For me, setting Generate Debug Symbols to Release No worked. This is under Apple LLVM 7.0 - Code Generation in Xcode 7.2.

+3
source

Have strip debugging symbols been noted in the build settings? You can do this (or not) depending on the configuration (build / release). You can also look into Objective-C Obfuscation for code (which is longer than the winder). From what I'm collecting, you cannot completely remove objective-c information, since all method calls are made dynamically, so the library must have information about your class / method names in order to function. Useful advice here .

If you have C ++ code, you can use the gcc strip utility, although I'm not sure how it looks like Objetive-C ++, if it isn’t you can compile all of you, cpp, into lib, separate it and link to him in his iOS project.

0
source

All Articles