This is the code i am using to generate ios build using nstask in my cocoa app.
NSTask *task=[[NSTask alloc]init];
task.launchPath=@"/library/Frameworks/Mono.Framework/Commands/xbuild";
task.arguments= @[@"/p:Configuration=Release",@"/p:Platform=iPhone",@"/p:BuildIpa=false",@"/target:Build",@"/Users/xyz/Projects/SimpleDemo/SimpleDemo.sln"];
NSPipe *pipe=[[NSPipe alloc]init];
[task setStandardOutput:pipe];
NSFileHandle *outputFileHandle;
outputFileHandle = [[NSFileHandle alloc]init];
outputFileHandle=[pipe fileHandleForReading];
[outputFileHandle waitForDataInBackgroundAndNotify];
[[NSNotificationCenter defaultCenter] addObserverForName:NSFileHandleDataAvailableNotification object:outputFileHandle queue:nil usingBlock:^(NSNotification *notification){
NSData *output = [outputFileHandle availableData];
NSString *outStr = [[NSString alloc] initWithData:output encoding:NSUTF8StringEncoding];
NSLog(@"%@",outStr);
[outputFileHandle waitForDataInBackgroundAndNotify];
}];
@try {
[task launch];
[task waitUntilExit];
}
@catch (NSException *exception) {
NSLog(@"%@",[exception callStackSymbols]);
}
@finally {
}
i am getting this error while running the code
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iO S.Common.targets: error : Tool exited with code: 134. Output: warning: (armv7) could not find object file symbol for symbol _xamarin_register_modules warning: (armv7) could not find object file symbol for symbol _xamarin_register_assemblies warning: (armv7) could not find object file symbol for symbol _xamarin_setup warning: (armv7) could not find object file symbol for symbol _main warning: (armv7) could not find object file symbol for symbol _OBJC_METACLASS_$_MonoTouchAppDelegate warning: (armv7) could not find object file symbol for symbol _OBJC_CLASS_$_MonoTouchAppDelegate
dsymutil(6764,0x7fff78631000) malloc: * error for object 0x6000000fb400: pointer being freed was not allocated * set a breakpoint in malloc_error_break to debug
In this build process error comes after .app generation means there is problem after .app generation.
Note:if i run this command using terminal then it works without any error and .ipa gets generated.Problem is only when i use nstask to run this command.
i am using el capitan and xcode 7.1.1. Any help would be appreciated.
As per the suggestion from @Itachi, issue is regarding the MallocNanoZone being enabled. This needs to be removed from the environment of NSTask explicitly.
Here is the code which I got from IPABuddy
Hope this helps.