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

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.

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.

Cocoa messes path up?

I'm trying to create an app that has an todays widget extension. This app should simply access a folder full of pictures, load them and draw them to the screen. One picture every hour. The widget should do the same, widget wise.
While loading an image in the main app and drawing it to the screen works flawlessly doing this:
NSString *tildePath = #"~/Documents/Adrian/Art/desertMovie.jpg";
NSString *path = [tildePath stringByExpandingTildeInPath];
_image = [[NSImage alloc] initWithContentsOfFile:path];
the extension completely messes up the path. It uses the same code as the main application but obscures the path completely.
From:
~/Documents/Adrian/Art/desertMovie.jpg
to:
/Users/Adrian/Library/Containers/ac.at.hulala.AK.ImageViewer2.ImageViewerWidget/Data/Documents/Adrian/Art/desertMovie.jpg
If I use a path without "~" the path stays the same but the image still doesn't get loaded.
Can someone tell my what I have to do that it accesses the same folder the main application does?
EDIT:
Archiving the app and exporting it seems to fix that problem. However I still would like to know how to make this working while developing.
EDIT2:
This is so weird! When working with the Todays Extension Widget a path like #"~/Pictures would lead to /Users/Me/Libraries/Containers/ac.at.ImageViewerWidget/Data/ like what the f***, why!?
When I force it to use the path #"/Users/Me/Documents/Pictures and run it the Memory Usage steadily increases until it reaches the limit and my system goes to hell. I really don't get that. I guess that the widget isn't finding any files so it tries to load the whole ssd. I guess. I really don't know whats the problem here.
Can someone please lead me into the light?
Not that xcode would tell you if something is wrong with your app. It will just allocate your whole memory and burn your cpu,
UNTIL,
you realize that the problem is caused by the lack of folder accessing permissions. Geezuz!
Add folder access permissions to your application if you want to access something!

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.

Xcode + Time Machine (or Finder copy) = NSInternalInconsistencyException

After using Finder to make a copy of my project, the iPhone Simulator crashes giving me an NSInternalInconsistencyException error. I subsequently used Time Machine to restore the project before I made the copy, but am still getting the NSInternalInconsistencyException error.
This is a small homework assignment and re-creating it wouldn't be the end of the world. My big concern is that I don't understand something fundamental about how Xcode is working. Any illumination would be greatly appreciated.
Update
Apple identified the bug. The iPhone Simulator keeps the last-run version of the app onboard, and doesn't replace it with the copied/Time-Machine-Restored version that is in Run-and-Build. Deleting the app from the iPhone Simulator and performing a new Run-and-Build resolves the issue.
Sounds like a bug. Your source code files should be fine, so hopefully it's not a big deal to just create a new project and add those files so that you can get back to work. You might also want to report the issue to Apple, especially if you can make it happen again.