Search code examples
testfairy

TestFairy NSLogs on iOS10 for Cordova


I am new to test fairy and asked support but I did not hear from them so trying here.

The problem is that I cannot see the raw logs window within the session on the iOS app but I can see it when in android or when I run the app on the iPhone Simulator.

I followed the instructions to the letter to export the app as adhoc ecc...

Here is the api documentation. https://docs.testfairy.com/FAQ.html

Oh I should also mention that I have a cordova / ionic app.

Thanks in advance.


Solution

  • Ok, so thanks to TestFairy amazing support especially @VijaySharma here is the solution for those in need.

    Find the .pch header file in Platforms > iOS > MyApp > MyApp-Prefix.pch

    In the header add the following.

    #ifdef __OBJC__
    #import <Foundation/Foundation.h>
    #import <UIKit/UIKit.h>
    #import "TestFairy.h"
    #define NSLog(s, ...) do { NSLog(s, ##__VA_ARGS__); TFLog(s, ##__VA_ARGS__); } while (0)
    #endif
    

    Save the file and Rebuild the app.

    Also if you want to show all the logs make sure you have this plugin: https://github.com/apache/cordova-plugin-console

    All set!