Header Social App Cells
AppStore JSON APIs
For the final data fetch of the Apps page, we'll need to render out the header cells that contain information for some social apps. This JSON data set will be fetched from this url: https://api.letsbuildthatapp.com/appstore/social. Once we parse this into Swift Decodable objects, I'll show you how to pass them into our header and render the information. Enjoy.

Comments (4)
antonskwr
4 years ago
Hey Brian! Got a little error here: “Error Domain=NSURLErrorDomain Code=-1202 "The certificate for this server is invalid. You might be connecting to a server that is pretending to be “api.letsbuildthatapp.com” which could put your confidential information at risk." I changed my App Transport Security Settings to allow arbitrary loads, it doesn’t solve the problem. After a bit more googling I found that people suggest to modify NSURLConnection delegate to ignore bad certificates during NSURLConnection loads. I don’t know much about backend engineering, but I have a feeling that the suitable solution would be to somehow fix the certificates on the server side :)
Brian Voong
4 years ago
antonskwr
4 years ago
Great, thank you for the quick fix!
Li Mao Clearlove
4 years ago
Hi Brian! Can you tell me the difference between completion: () -> () vs completion () -> Void, thank you!
Brian Voong
4 years ago
e.tavares
4 years ago
Hi! My header is not displaying anything and my code is exactly like yours but if I run your demo project it works why?
Brian Voong
4 years ago
e.tavares
4 years ago
I added a print statement inside of do block inside fetchSocialApps and It did not get printed.
Brian Voong
4 years ago
e.tavares
4 years ago
Got it.Thank you!
e.tavares
4 years ago
Actually I didn't .I will just use your project from now on.My code is exactly like yours.Don't know what is happening.
Brian Voong
4 years ago
gabedelvillar
4 years ago
Hi, I am having the same issue. Did you find a solution?
DeltaWhiskey
3 years ago
I was having the same issue as well. I realized I had missed the collectionView.reloadData() call he added at the 11:00 mark.
aliang330
3 years ago
did you add .resume() at the end of the network request ?
Patryk Pawlak
4 years ago
Hello Brian :) I have these warnings whenever I rotate my simulator 2019-09-02 09:49:59.754474+0200 AppStoreJSON[2504:609105] The behavior of the UICollectionViewFlowLayout is not defined because: 2019-09-02 09:49:59.754611+0200 AppStoreJSON[2504:609105] the item width must be less than the width of the UICollectionView minus the section insets left and right values, minus the content insets left and right values. 2019-09-02 09:49:59.755918+0200 AppStoreJSON[2504:609105] The relevant UICollectionViewFlowLayout instance is <UICollectionViewFlowLayout: 0x7f9518516ad0>, and it is attached to <UICollectionView: 0x7f9518859000; frame = (0 0; 414 896); clipsToBounds = YES; autoresize = W+H; gestureRecognizers = <NSArray: 0x600003a6a8b0>; animations = { position=<CABasicAnimation: 0x6000034bd480>; bounds.origin=<CABasicAnimation: 0x6000034bd5a0>; bounds.size=<CABasicAnimation: 0x6000034bddc0>; }; layer = <CALayer: 0x600003462be0>; Would You make a separate video abt how to debug such issues, or just write a short answer? I`m a newbie, sorry :C
dclawson
3 years ago
Does it actually cause a crash, or is it just a warning? I've found that lots of autolayout stuff will generate warnings that don't actually affect performance.
HELP & SUPPORT