NSLog not logging output in console - xcode6

This issue is driving me crazy since last few days. In my project I have several NSLog statements that were working fine until recently.
I have tried Command+option+C to make sure my console is not disabled as shown in this answer here:NSLog not printing to console
I can see NSLog outputs in other new project that I create.
My question is, could it be something that I might have changed accidentally that has disabled logging NSLog statements/
I am on Xcode 6.3.2.

Related

Why is my AUv3 randomly disappearing with "viewServiceDidTerminateWithError"?

I’ve encountered a strange problem during iOS AUv3 Instrument development which I’m having trouble finding information on. I’ve spent a couple weeks now attempting to debug this, and I was wondering if anyone else has encountered it. It feels more like an "OS killed the app" than a crash, so I use the term crash loosely. Here are the symptoms:
It doesn't seem to ever happen on initial instantiation; it's when a project is reloaded. But, you can comment out setFullState and it'll still occur.
The “crash” is inconsistent. Like a lot of slippery bugs, it’ll start happening consistently and then it’ll stop happening completely.
When it does happen, it initially appears to load fine: the view loads and looks correct, and it produces audio. But, after a couple seconds, the plugin view disappears and it stops producing audio. I see this in the console log:
viewServiceDidTerminateWithError:: Error Domain=_UIViewServiceInterfaceErrorDomain Code=3 "(null)" UserInfo={Message=Service Connection Interrupted}
You don’t have to generate any MIDI events to crash it. It would crash even after I commented out the processing block.
If anyone has any ideas, including how to get some useful debugging info out of this situation, let me know!
I tried to look at crash logs, but there are no crash logs generated
didReceiveMemoryWarning is not tripped. In fact, I did an experiment where I allocated 100 megs and memset’d it on startup, and it didn’t crash it.
I tried attaching a debugger, but it goes from “no debug session” to “waiting to attach” after it crashes-- at no point does it actually attach. It will attach if I then reload the plugin, but then it won’t crash. The Zombies and Leaks tools didn't reveal anything, nor did the memory sanitizers.
Using a Storyboard instead of a XIB didn't change the behavior (not sure why it would, but it was one of the last few differences between this and Apple's example).
I created a very tiny example project which exhibits the problem (unfortunately, I cannot post any code which shows the problem because I cannot find where exactly the problem code is-- maybe it's even a project setting?). It has a minimal GUI, no setFullState, and generates white noise:
https://drive.google.com/open?id=1dw3xTHn3qY411eXLaIb_9_S5PAtrr5Nk
Expected: It doesn't crash or disappear randomly
Actual results: After reloading a project file which uses this AUv3, the plugin will disappear after a few seconds. It initially produces audio normally and the GUI looks OK, but then vanishes.

react-native init fails on device in v0.30.0

Everything was going swimmingly until 0.30.0 rolled in. You could just go to AppDelegate.m and put in your IP address, and 'bam!' It worked!
No more. I tried changing 'localhost' in RCTWebSocketExecutor.m, I tried the silver bullet and non-silver-bullet approach to editing info.plist, re: App Transport Security Settings, I even sacrificed a ring-tailed possum to RCTBridgeToTheGods.m, nothing.
It works in the simulator, but not on my device. Again, it was working on my device a version ago, so I think I have everything set up that ... well, would be set up to make it work in 0.29.0-land.
The behavior goes: the xib launch screen launches, and I can even get my own launch screen image set to work, but then I hit a white screen with just a status bar, and nothing else. To the output is logged: 2016-07-26 15:43:37.240 [warn][tid:main][RCTEventEmitter.m:52] Sending 'websocketFailed' with no listeners registered.
I looked through every post tagged react-native since the release of 0.30.0, and there were no answers. I asked Reactiflux, but they seem to be tired of helping people get up and running. If anyone can help, it would be much appreciated. Best wishes!
I had the same issue and I think it was caused by the new project template, specifically AppDelegate.m. I was able to load the app but only with a static JS bundle. I commented out the following line:
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:#"index.ios" fallbackResource:nil];
And replaced it with the line from the old project template:
jsCodeLocation = [NSURL URLWithString:#"http://[your IP]:8081/index.ios.bundle?platform=ios&dev=true"];
I still had to Allow arbitary loads in Info.plist but those two changes solved the problem for me.
I'm not sure if this is the right way to fix it, there might be a new way of doing things that nobody mentioned in the docs or this is an actual issue.

Ported OSX Obj-C/CG Screenshot Code to js-ctypes - crash on final line

I ported some objective-c/CoreGraphics code that takes a screenshot of multiple monitors but it's not working. The jsctypes guys won't be able to help because the section is just me answering questions lol
The objc/cg code is from here: https://stackoverflow.com/a/28247749/1828637
My jsctypes type/struct/declares are here: https://github.com/Noitidart/NativeShot/blob/mac-troubleshooting/modules/ostypes_mac.jsm
The jsctypes port is here: https://github.com/Noitidart/NativeShot/blob/mac-troubleshooting/modules/workers/MainWorker.js#L443-656
And the last line is line 643 which causes the crash:
var rez_writeToFile = ostypes.API('objc_msgSend')(data, ostypes.HELPER.sel('writeTofile:atomically:'), myNSStrings.get(OS.Path.join(OS.Constants.Path.desktopDir, 'full_ss.png')), ostypes.CONST.YES);
This coincides with the objectivec of
[data writeToFile:#"/tmp/screenshot.png" atomically:YES];
except i changed path to ...desktop/...png
I wrote to sepearte gists, to align the lines in text diff software to make sure I did everything.
Here is objc/cg: https://gist.github.com/Noitidart/8affcd8bee60d22dcb52
and here is jsctypes: https://gist.github.com/Noitidart/3d4a4e8df625dbea8cc1
I dont think i missed anything i dont know why it crashes on that final line
Do any of the ObjC/CG people see any type definition that is wrong or something that I missed (for example the ObjC code uses compound statments I'm not sure I understood/translated them correctly in the port).
Wowww so after struggling for like some hours then posting this I realize it right away haha
Casing typo in selector!! I had writeTofile:atomically instead of writeToFile:atomically!
If anyone would like to test this out, it's a simple firefox addon test case.
Install an addon that allows installing addons from github repos from here: https://addons.mozilla.org/en-US/firefox/addon/github-extension-installer/
Go to commit on this branch that works here: https://github.com/Noitidart/NativeShot/tree/f5f2e8606d3c5c657e901239d3ceb8c8c79a4494
Then click the "Add to Firefox" button at bottom right, below the "Download Zip" button
Click on the toolbar button icon that gets added to firefox, as seen in this screenshot: http://i.imgur.com/n7lSxje.png
Check desktop you now have a single png file with a screenshot of all the monitors, huge props to #KenThomas!

nsmanageobjectcontext.save stopped working in iOS7

The project I inherited was built and launched in April 2013, and it worked perfectly for ios 5.1, ios 6.0 and ios 6.1.
However i just installed the app to an iphone that has ios7.0 and it didn't work. I looked at the code and I see that the app downloads some JSON data from the web, and then when it tries to run the following 3 lines of code, "nothing happens" after the 2nd line.
NSError error = nil;
BOOL isSuccessful =[self.tempMoc save:&error]; // where tempMoc is a NSManagedObjectContext
NSLog(#"errrrrrr ----- %# --- errrrrrr", error);
When I say nothing happens, I mean that the code execution stops on the 2nd line, and no code after that line gets fired. I tried putting a breakpoint on the second line, then stepping into the function, but nothing happens...xcode doesn't show me anything new afterwards. The app in my simulator also hangs.
I tried changing the deployment target of my project from ios6 to ios7. Again, this yielded no effects.
What should I do next?
ADDITIONAL NOTES
I've been reading other stack overflow answers and some people say the a hanging [NSManagedObjectContext save] might be a threading issue. I'm not sure how to confirm if my issue is a threading issue. I know that there's only ONE place that calls the [NSManagedObjectContext save], and that's the one place where things are hanging. I tried putting a
[self.tempMoc.persistentStoreCoordinator lock];
right after instantiating self.tempMoc, but that had no effect.
I figured out the issue.
It was indeed multiple threads manipulating the NSManagedObjectContext that caused hte save function to hang.
My solution was to rewrite the code to get rid of all the extra threads. I was left with only the main thread and this fixed the issue.

App crash - "DiskImageCache: Could not resolve the absolute path of the old directory."

I am working on an app, where I display the data entered by user in a PDF file. PDF File is also created dynamically.
All this is fine.
I have implemented QuickLook framework to display the pdf file. When I call the QL framework, PDF file id displayed quite fine but when come back to the calling screen, my app crashes without any crash log or memory warnings.
I am calling QL with below code:
[[self navigationController] presentModalViewController:qlPreviewer animated:YES];
logs created are
DiskImageCache: Could not resolve the absolute path of the old directory.
[Switching to process 3070 thread 0x17603]
[Switching to process 3070 thread 0x15503]
This is quite interesting.....
When I run the same program in Instruments to check for leaks and Memory Management, i can only find leaks when PDF document is scrolled and all the pages are viewed.
However, interestingly there is no app crash that I can see.
Also, I did try with ZombieEnabled = YES and without it but no app crash with Instruments.
I am quite clueless on how to interpret this and have been trying different things to solve this. Also, I have tried UIWebView but the result is the same.
I was again trying something to check out the issue and found something interesting.
When i execute the code directly from X-Code - i get the crash in as explained above.
In other instance, if I execute the app by clicking on the app in the sim... no crash
I am yet to check this on device. Can someone confirm the crash on the device?
Also, Google does not have answer to this question.
Thanks in advance for your answers.
Can anyone shed some light on this?
I'm having the exact same issue.
As a workaround, you can disable or remove your 'All Exceptions' breakpoint. This might make debugging a little more difficult, but it's not as bad as having to relaunch the application all the time.
This is the breakpoint causing the issue. I had set it so long ago that I'd forgotten it was there
Deleting application from device helped me to solve this problem.
Maybe also at first you should try "Product > Clean" to ensure that all resources will be copied to your device.
I was able to fix mine with this code:
FirstViewController.h
NSURLRequest* reqObj;
#property(nonatomic, retain) NSURLRequest* reqObj;
FirstViewController.m
reqObj = [NSURLRequest requestWithUrl:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:60.0];
NSURLConnection* conn = [[NSURLConnection alloc] initWithRequest:reqObj delegate:self];
then instead of loading it on my view after this line i waited for the connectionDidFinishLoading then load it to my view
Interesting: This has just started with my app too. No errors when checking for leaks but running the app in the sim actually is causing a Breakpoint, not a crash. I can hit the continue and the app keeps running, no problem.
My issue also is relating to a PDF, but I'm just using a web view to display a PDF from the app bundle. I've checked everything in the dealloc, it's all good, this may be a iOS 5.1 bug. I will update as I learn more.
#JimP, It isn't an iOS 5.1 bug. It has just started happening to my app as well, on iOS5.0. It seems to only affect pdfs of more than one page length, and seems to trigger most commonly on scrolling past the end of the document (although sometimes earlier also). It also seems to happen more often on a second load.
This could happen when you delete the object reference in code but having its reference in xib. Delete the outlet that you no longer need.
Just ran into this problem of loading a pdf file in an App I am converting to iOS 8. This App has been running fine since the first iPhone. I just removed the All Exceptions breakpoint to work around it.
I don't know if it's the same problem but I had an issue where switching from a PDF view to another more than three times via the tab bar controller caused a crash.
Turned out that embedding the views I was switching to within Navigation controllers put a stop to the crashing.