How do you print debug messages from native iOS extensions? (SOLVED)


I’m currently making an iOS extension, but at the moment I’m getting unexpected results at run time, and I want to see what my variables are holding. But since I’m bundling my app and running it on my device, I can’t see any print() logs from Lua or printf() logs from C++ or Objective C.

I’ve looked at this link and got up to the “path mappings” section before the instructions became too unclear to continue. I don’t know what the “engine source” is in this context, nor what the path names mean. This might be related to my issue.



This manual lists the possible ways to read the output from your game:



Solved, I ended up downloading a log file from the device thanks to that link. Unfortunately it doesn’t capture C++ or Objective C printf calls, but it will do for now.



It should include dmLogInfo() and the rest of the log functions from the Defold SDK.



That it does! I originally tested it with dmLogDebug, which wasn’t working for me, so I was confused. dmLogInfo is perfect though, thanks.



I would have thought dmLogDebug would show as well. There’s also dmLogWarn() and a few others:



This setting is extra verbose, and is disabled by default.
We don’t really use it much to be honest. We mainly use dmLogInfo, dmLogWarning and dmLogError.




I’ve the same problem : I’m trying to debug my own ios extension using log messages but I can’t see my printf(…) or fprintf(stderr,…) from my C files in my ‘log.txt’ downloaded file. How can I use dmLog Does I need to install all the dmEngine sdk?

Thanks for your help…

1 Like


You already have access to the sdk on the cloud build server, so no need to install anything.

By using our dmLog* functions, you’ll make sure the output is visible in the logs on all platforms (e.g iOS and Android) where printf won’t work.

Note that these functions only work in debug builds.



If you sign the application with an iOS Developer certificate (as opposed to a distribution cert) you will also be able to see the output in the Console app on macOS.



I’m using “Personal Team” certificate to sign my ios application. Is there a known problem concerning the output in the Console app on macOS using this certificate?

Other remark/question:
I may have missed something : I build manually (and locally) my ios library calling make -f … and putting the “.a” file in my defold “lib” folder. How can I build this library on the cloud build server ?



I think I understood…
I will group my native code in the “src” folder of my extension. By doing this, my native extension should be built in the cloud…

Currently, I compile it outside (external folder) to produce an external library that I copy into the “lib” folder of my extension (so I have to call manually xcrun make -f …)
I was inspired by the organization of the native extension fmod (
I will rather take inspiration from the organization of the native extension “ios-android in-app purchase” that you provide as an example in the documentation ( ;o).

I will try and I will keep you posted…

1 Like


Success and It’s better !
I put all my native code into the defold project (I gave up going through an external library) and now, I can trace/debug my ios native extension…
By the way, I gain a simpler, more fluid compilation ;o)

1 Like