Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Mane_ios

macrumors newbie
Original poster
Mar 29, 2016
6
0
How to resolve this error? I am new to programming and got totally struck with this error in all llines of code attached below

Code:
videoObj.videoid = video("snippet.videoid") as! String

videoObj.videoTitle = video("snippet.title") as! String

videoObj.videoDescription = video("snippet.description") as! String

videoObj.videoThumbnailUrl = video("snippet.videoid") as! String


Error Screenshot

http://i.stack.imgur.com/OyjNP.png
 
Last edited by a moderator:
Your using a 'Contructor' method to set a property. You either need to do obj.description = "my description"

Or, having made a custom constructor
ObjClass obj = ObjClass("id", "description", "title")

I would recommend the second one.

Note: excuse any small error, written on mobile and haven't studied swift massively
 
Your using a 'Contructor' method to set a property. You either need to do obj.description = "my description"

Or, having made a custom constructor
ObjClass obj = ObjClass("id", "description", "title")

I would recommend the second one.

Note: excuse any small error, written on mobile and haven't studied swift massively
Thanks you so much sir...
 
You're calling video and passing it garbage as far as I can tell. Maybe it's a constructor maybe it's a function, who knows. "snippet.videoid" is a string where I suspect you want to pass the value assigned to that string. In another line you pass in a string called "snippet, videoID" into video.

If you're still having problems, it would be better to post the code, in particular the video(...) section.
 
You're calling video and passing it garbage as far as I can tell. Maybe it's a constructor maybe it's a function, who knows. "snippet.videoid" is a string where I suspect you want to pass the value assigned to that string. In another line you pass in a string called "snippet, videoID" into video.

If you're still having problems, it would be better to post the code, in particular the video(...) section.
@tyche thanks a lot for responding,please find the code below:

http://stackoverflow.com/questions/...nction-type-element-aka-keyanyobject-valueany
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.