0

I'm developing a recorder app on the iPhone. For testing my app with external USB microphones, I need to unplug the iPhone from the Mac so that I can attach the microphone.

My problem is that once the iPhone is not connected to the Mac anymore, I can not debug my iPhone app, nor can I view the console output. Is there a way to connect the debugger through another medium than the USB cable, e.g. network or bluetooth?

I've read that after jailbreaking your iPhone, it is possible to install ssh, connect to the iPhone using ssh, and tail the syslog. This is a solution that I would immediately use if it would not require jailreaking the phone. I do not want to jailbreak every phone on which I would like to test my app.

Any nonstandard but reliable solution for viewing log output is also appreciated. E.g. I'm currently using a quick'n'dirty written HTTP server on the iPhone and then using the browser or telnet from the Mac to connect to the iPhone and view the console output.

1

4 Answers 4

2

I've made library DVFloatingWindow, that can be used to view the console output directly in application. You just have to use DVLog instead of NSLog:

DVLog(@"Some message %@", parameters);

Also you can view several logs by creating separate tab for each of them. There's ability to send all logs via email with button press.

0
2

Maybe this might be the answer for you, if you are seeking for real-time debugging + you do own iPhone 4,4S or older iPads ( 30-pin connector ). With this accessory you should be able to connect to your mac (XCODE) + to your external accessory

http://www.cablejive.com/products/dockStubz.html

1

You can write your debug logs into file and After testing you can see them.

@interface LogFile : NSObject
+ (void)WriteLogWithString:(NSString *)log;

@end

And here is implementation file

@implementation LogFile


+ (NSString*)CurrentSystemTime {
    return [[NSDate date] description];
}

+(NSString*)getDocumentsPath
{
    NSString *path  = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
    return path;
}

+ (NSString*)getLogFilePath
{
    NSString *loggingFilePath = nil;

    loggingFilePath = [[self getDocumentsPath] stringByAppendingPathComponent:@"/MYLogFile.txt"];
    return loggingFilePath;
}


+ (void)WriteLogWithString:(NSString *)log
{

        if(log != nil){

            NSString *locationFilePath = [self getLogFilePath];

           NSString *str = [NSString stringWithFormat:@"%@  %s [Line %d]: %@", [self CurrentSystemTime],__PRETTY_FUNCTION__,__LINE__,log];            
            FILE *fp = fopen([locationFilePath UTF8String], "a");

            fprintf(fp,"%s\n", [str UTF8String]);

            fclose(fp);
        }

}

@end

Now you have to just call the method like this

 [LogFile WriteLogWithString:@"sachin thakur"];
2
  • Thakur sahab don't forget to enable itunes file sharing key. So that log file can be pulled from device using itunes Jul 23, 2013 at 15:32
  • @InderKumarRathore yeah Rathor sahab. Jul 24, 2013 at 6:10
1

When I was working with MFi, I had an Apple-provided dongle which allowed the iPhone to simultaneously connect to the computer and the accessory.

You can also view the console printout via the Xcode organizer in the Devices tab under your device.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.