Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
What type of issue are we talking about? I know iOS development, if its Swift, maybe I can at least help narrow down the issue
-
@gitpush so I’m using Alamofire for networking for the first time. I can get the JSON fine and even get the code to print to console. But I can’t get the data to store to a dictionary so I can display it in a table. I tried printing the dictionary and it’s coming back nil every time. So naturally when I try to load the tableview with the data it crashes because of the nil value. The data I’m trying to get is an array or dictionaries nested in a JSON object. Sorry for the long explanation lol
-
@IMDownerzac Why don't you use SwiftyJSON, I too use Alamofire, and when I receive my JSON string using responseJSON function, I simply do:
switch(alamofireResult.result)
{
case .success(let val):
let jsonValue = JSON(val)
// jsonValue is now a SwiftyJson Object
// You can get your data as: jsonValue["myVar"].dictionary <-- is an optional
break
case .failed(let error):
print(error.localizedDescription)
}
SwiftyJson github link: https://github.com/SwiftyJSON/... -
@IMDownerzac is your condition valid? I mean is arr count > 0?
if yes, what does your UITableViewDataSource read from?
When you implement:
numberOfRowsForSection
and cellForRowAtIndex
which array are they reading from? -
@IMDownerzac it is failing to get a reference of your table, did you connect it from StoryBoard to your ViewController? is your IBOutlet nil? From the place where it is failing I can only think of tableView being nil
-
@IMDownerzac if it was because your array is nil, it will fail when it is accessing the array in this case in cellForRowAtIndex and numberOfRowsInSection
-
And if your IBOutlet is not nil, have you set UITableViewDataSource and UITableViewDelegate of your UITableView?
(right click + drag from your UITableView in storyboard to the FileOwner object (yellow icon on top of the view in storyboard, it is the left most icon) -
@IMDownerzac but Referencing Outlet is nil, this is your issue, you need to connect your UITableView to your view controller,
Open both your storyboard and viewcontroller side by side, right click + drag your UITableView to your ViewController code, and create a reference
the resulting code of the reference should be:
@IBOutlet weak var NAME: UITableView! -
@IMDownerzac On the left of the code page, there should be a circle is it an empty circle or a filled circle?
if empty then it is not connected to anything if a filled circle then check to which tableView it is connected -
@gitpush it was filled in but linked to another tableview on a different view (not sure how it happened) but I deleted it and reworked it and now the code runs. You are a genius! Thank you so much!!!
Related Rants
-
mBeierl19That's when I sold my bitcoins for wedding gift shopping.
-
Wollow-Wizard7When you try to become over smart with Apple. Client :- Ask for all user information in registration screen. ...
-
IMDownerzac7Client: Can you build a Snapchat clone but better? Me: Iām going to say probably not logical given the reso...
When you’ve been stuck on the same issue with your code for 4 days š
rant
well fuck
ios development
trying new things and failing
swift 4