I have a bit of code that runs through a logged in FB user and checks their Likes to see whether or not they’ve liked my App.
All working perfectly… until I went and liked a French comedian named Rémi GAILLARD, which now seems to break my code with the following error:
03/10/2012 12:46:40.389 SuperSushiSD: Lua Runtime Error: lua_pcall failed with status: 6, error message is: NSInvalidArgumentException: *** -[__NSArrayM insertObject:atIndex:]: object cannot be nil
It’s definitely him because if i Unlike him on Facebook then the code works perfectly, I’m wondering whether it’s something to do with the accent above the ‘e’ in his first name?
I can’t seem to do anything to fix this beyond unliking him - but worried that this will cause further issues for other users.
Here’s my code that essentially parses the json response object received from Facebook:
elseif ( "request" == event.type ) then
-- event.response is a JSON object from the FB server
local response --= event.response
-- if request succeeds, create a scrolling list of friend names
if ( not event.isError ) then
response = json.decode( event.response )
local data = response.data
--dump(data)
for i=1,#data do
--dump(data[i])
local name = data[i].name
print("name: "..name)
if name == company then
\_G.likeUs = true
print("Setting likeUs to true")
break
--Save()
elseif i == #data then
\_G.likeUs = false
print("Setting likeUs to false")
end
end
elseif ( "dialog" == event.type ) then
end
end
end
I’m really unsure what I can do, as there’s not a lot to the code it just seems to throw a wobbly when it comes to the offending Like - could it be something to do with the way in which json.decode is handling the offending accent in the data? [import]uid: 33275 topic_id: 31593 reply_id: 331593[/import]
