iOS Facebook SDK not retaining delegate causing an EXC_BAD_ACCESS - automatic-ref-counting

I'm using the Facebook iOS SDK for a project and if I pop a UIViewController after doing a request but before receiving an answer I get an EXC_BAD_ACCESS when it tries to see if the delegate responds to a selector. Well, the delegate is the UIViewController already popped so it probably doesn't exist anymore.
When researching about this issue I stumbled upon this answer here on SO which tell me I shouldn't be having this problem since the delegate is retained. But the answer is a little old and they started to use arc after that. So I checked the SDK and noticed their not retaining it anymore.
Is this a known issue? Am I missing something here?
I tried modifying the SDK and retaining the delegate and the problem disappears. Nevertheless I don't like modifying third-party libraries as I don't have that much expertise and I'm not sure if arc is really a problem in this situation (I thought we didn't need to use retaing/release/autorelease anymore). Also, I thought this being Facebook SDK, if it were a bug someone should already stumbled upon the same problem and solved it.
EDIT: I realize now that at least the version I'm using of the Facebook SDK is not using arc (I don't know if they already support it) and the problem may be this:
#property(nonatomic,assign) id<FBRequestDelegate> delegate;
Shouldn't it be retain?
EDIT2: I'm sorry, I skipped through another answer in the same post linked earlier.
It seems what I pointed out is now obsolete in newer versions of the SDK. The best approach seems to be to cancel the request.

Shouldn't it be retain?
Absolutely not. If you did that then you'd very likely have a retain cycle (VC owning the FBRequest which owns the VC).
You're 100% correct that the right thing to do is cancel the request when the view controller is deallocated, or probably even better is to set the delegate of the request to nil and then cancel it.

Related

W3C Feature (GeoLocation) Deprecation timelines

Now that W3C have officially deprecated the GeoLocation API
How long do we have before our existing navigator.geolocation code stops working?
Is there some feature/API retirement that we can refer to as an example?
Most importantly who approved this? #GeoLocationIsNotaSensor! Sorry I take that back, MOST importantly who ask for a GeoLocation Sensor?
There is no mention of deprecation whatsoever in the page you linked to.
What this warning box says is that the specification of this API has been moved to an other working group, Geolocation Sensor.
So given they even created an entire working group for this API, I'd bet it's not going to get away of browsers' implementations any time soon, but future can prove me wrong...

Fetching data from API for ReasonReact app

I'm learning ReasonReact and I would like to fetch data from a API, that I'm going to use on my component. However, on the official website about Reason or ReasonReact there's nothing about this, neither I found something searching on Google. How can I do it?
You can use the existing bindings to HTTP client libraries, e.g.:
https://redex.github.io/package/bs-fetch
https://redex.github.io/package/bs-axios
The former works in browser only, the latter works in both browser and Node.
In general, if you're looking for a way to do something, Redex is a great place to look.

GET request updating 'seen' status

First of all, I am aware of the details mentioned in the HTTP 1.1 specification saying GET requests should be idempotent, and it all makes total sense to me. I'm always using POST requests for login/logout, form updates and everything that changes the state of my web app, but I have a problem with one particular scenario.
Imagine you're displaying a list of user's notifications, and you want to update the seen status once they've been rendered into html. The simplest solution is to perform an update of the model instances during the GET request, but that's where it would break HTTP 1.1 specs. Not only it would not follow the specs, but I'm also concerned about url prefetching and automatic GET request retry in some browsers, and maybe other possible scenarios.
Doing it using AJAX also doesn't seem like a good enough solution to me, because I would like the web to also work correctly with JS disabled.
The site also has an API for iOS/Android, but there it can be easily solved in multiple ways which seem right to me, so that's not a problem.
Did you guys come across any similar problem to this and found a way to handle it? I can't seem to find a good solution to this problem. Any help is appreciated.
Ok, so I think I found a solution which makes sense. I'm going to implement the AJAX solution (POST) + a 'Mark all as read' button (POST) as a fallback for the edge case.

No signals emitted from QTableView

For some reason, my QTableView seems to never emit a single signal. At first I tried connecting to any slot programmatically, but then I realized even through the Signal/Slot Editor from the GUI I could not make something happen, no matter which signal or slot I chose.
One detail that I noticed after a lot of research was that the Qt Documentation specifies that "The signal is only emitted when the index is valid.", so I understand this may be a problem with my models.
However, I still have no idea what might be the issue, or how I can fix it. Displaying the cells work perfectly fine on all models I have, but none of them seem to provide the correct signaling behavior, so I can't really detect the problematic code to post it.
It might be relevant to note, I tried disabling editing, and I'm testing this on Mac OS X Lion 10.7.5.
I appreciate any help. This is my first question here, although I've long benefited from those asked by others. So, yes, I've thoroughly searched for solutions.
Okay, I finally figured it out. After I realized Qt Creator was never updating the executable, no matter which code I changed, it was simply a matter of manually cleaning the build directory. Using the GUI options to do so (either rebuild or clean+build) hadn't had any effect. I guess it's because I had renamed the project, but didn't update the build directory or something. I had changed (improved) so much code since then that I would never have guessed there was an issue as everything was working fine, until I decided to add some more functionality.
As I had expected, this is kind of underwhelming for my first published issue, but I don't think it deserves negative points. The reason I didn't post some self-contained code is because I had no idea which code was causing the issue; I suppose I was just expecting someone with more experience to point me in the right direction. In the end, it wasn't even an issue with my code, it was with Qt Creator, so I really couldn't have been clearer.
I'll keep this as it might be useful for other people, so
tl;dr Qt Creator was silently failing to recompile the code, and the solution was to manually remove the old binaries.

Visual Studio 2010: Editor stops responding to keyboard

I've got this very odd bug that appears to be a quirk in Visual Studio 2010: Sometimes, when moving the cursor into double quotes of a CSS style="" attribute the cursor refuses to move. I can't type anything, and the keys that respond are the UP/DOWN cursor keys and the DEL key (but not BACKSPACE).
Typing does nothing, but pushing LEFT/RIGHT on the cursor keys produces the following error:
The operation could not be completed
I've got no idea what's causing this, but I would hazard a guess that Intellisense is getting very confused and bugging out.
At the moment, whenever this happens, I have to write any CSS outsite of the double quotes of the style attribute and then place the cursor where I want the CSS to appear (using the mouse) and press CTRL-V to paste it in. Very annoying :(
There must be a way of fixing this problem...?
Hopefully someone has an answer!
Just encountered the issue in VS 2012, in editing C#.
I noticed that the problem had occurred soon after the trial period of Resharper has ended and i inserted a valid license number. It also happened in only some of the source files.
The solution: Tools->Options->Resharper: Suspend.
Try typing - should work now.
Then: Tools->Options->Resharper: Resume.
Problem gone.
I have encountered this using Visual Studio 2013 and Resharper 8.2.1. None of the solutions provided in this thread worked (even suspending and resuming Resharper)
After contacting JetBrains support, it turned out to be a caching issue.
Deleting all the files from the following directory solved the issue, as Resharper re-creates new caches:
C:\Users\[Username]\AppData\Local\JetBrains\ReSharper\v8.2\SolutionCaches\[Project_reference]
I have some odd issues with the editor occasionally, a workaround for me is:
Ctrl-Tab (x2) to another code file and back to the same code (or alt tab to another app and back, one of these two... can't replicate issue to be sure)
An ultimate solution might be a re-install.
Microsoft have had variations on this problem reported quite a few times via their support portal. Here is one post and if you scroll down you will see a comment with a bunch of other reports all detailing similar(ish) problems.
Microsoft doesn't seem to be able to reproduce the problem but are "duping all the similar keyboard locking problems to a central bug, so that we can think a way to log the events if necessary". Which seems to be a generic response to a lot of these posts. Some people reported that it was simply becuase another window/pane/tab was in focus but I can see the OP obviously did not have this specific problem. Looks to me like one of those random unresolvable bugs. Hope I never get it! There's also numerous forum posts around the Internet, where users stated that removing certain 3rd party plugins has solved this issue.
I just spotted this particular post which has a possibly useful comment on it for you (which also link to this SO post. As I do not have the bug I cannot test its validity for you. The main point of it seems to be something about the keyboard layout switching.
I'm sorry for putting all this into an answer when technically it is not an answer and just a mass of research, but there was no way this was gonna fit into a comment. And also sorry for pretty much link spamming, but again there was no way I could extract everything that they said into this post. I hope there is something useful in there for you :)
EDIT: You should probably check the top rated answer below as this seems to solve a number of peoples issues, although I never had the Resharper plugin and still occasionally experienced this, but now I'm on VS2013 and have not had this problem re-occur, so maybe they fixed it...
Empty the solution cache folder
C:\Users\{UserName}\AppData\Local\JetBrains\ReSharper\v8.2\SolutionCaches\
This was suggested by JetBrains support when I contacted them.
Permanently fixing... Not too sure however I found that pressing pressing Ctrl+Shift+Caps Lock+Tab all at once seems to get rid of this and enables the mouse and keyboard again. I know this isn't the best of solutions but it works.
I have the same problem several times a day. I didn't notice it until I installed the web essentials extension. I just uninstalled it and will see what happens. I have tried reinstalling visual studio with no joy (but again, I didn't notice the problem until after I had already installed the various extensions).
Sometimes, closing and re-opening the specific code window I'm working in fixes it. If that fails, sometimes I close all windows and reopen just the one I was actively editing. If all of that fails it usually requires a complete restart of visual studio.
I find it funny that MSFT says that they can't duplicate the problem. Scott Guthrie experienced it first hand during his MVC4 beta demo here at about 28 minutes in.
UPDATE: So far, as of 4-5-2012 9:33am Central Time, the problem hasn't recurred since uninstalling Web Essentials. This is the longest I've gone without this bug occurring. If I make it through the next 24 hours, I'll be confident in blaming Web Essentials.
UPDATE: 4-6-2012 10:05am Central Time: Well, apparently it wasn't Web Essentials. It happened to me again this morning editing the contents of a block in my _Layout.vbhtml file. Closing the tab and reopening it fixed it.
I frequently encounter this editor freeze, not just on CSS quotes but any file arbitrarily. I have a dual monitor setp and I have the doucment windows one one monitor and all tool windows on the next one. Sometimes, certain tool windows would freeze too (i.e. not respond to click).
Previously, I used to shutdown/restart IDE; but serendipitously, I discovered that switching to/from Full Screen mode, restores sanity. So now everytme I see a freeze, mode switching comes to rescue.
Not sure if this will solve your issue, but worth a shot.
Rant: In general, I find this new WPF based product very falky and unstable than its predeccessors.
I have the same problem on IDE, some times the Return key is not working at all...
My solution is: CLEAN the project/solution.
BTW: CLEANing resolve also other unexpected behaviours after amendements on CSS or HTML.
I tried every other workaround here but nothing seemed to work, and the issue was only present in one solution but not another.
Disabling Resharper fixed it temporarily but it came back after re-enabling it which wasn't a viable long-term solution.
What worked for me was disabling all Resharper Extensions (Under Resharper -> Extension Manager). I was able to type again even after re-enabling all of them, so I'm unsure which extension specifically caused the issue, but that's another route to try for people who still have this issue.
I never had the problem until I installed plugins/extensions. Curious to know if anyone has had this problem without having any plugins/extensions installed. I don't know if they are the actual cause but since benefits of the plugins outweigh the occasional lockup, I have left them installed. BTW, I use the "closing/reopening of the window with the lockup" technique.
Using a source control (GIT, AKSVN)? If so, disable it, restart VS then enable it and open the solution again.

Resources