---
# System prepended metadata

title: 'Twitter Hints (iOS: Objective-C)'

---

# Twitter Hints (iOS: Objective-C)

The following hints address common issues when developing the iOS Twitter App.

<details>
<summary style="font-size:1.25em; font-weight: 600"> Blurry profile Images? </summary>


According to Twitter API Documentation, the profile image sent back in the API response will add a format string. 

Here is an example of the profile image string that contains for format parameter:
```
https://pbs.twimg.com/profile_images/1273023374541742080/9pyUkLQo_normal.jpg
```
As you can see there is appended to the string `_normal`. What this does is it will re-size the image to be 48 by 48 pixels. The profile image when passed into a **UIImageView** of any size, will have a blurry version of the profile image. To get back the original profile image with its highest quality, you have to remove the `_normal` string from the image path like follows:
```
https://pbs.twimg.com/profile_images/1273023374541742080/9pyUkLQo.jpg
```

How you can do this in iOS is actually simple. There is a method within **NSString** that is called `stringByReplacingOccurrencesOfString` that you can use to remove the unwanted string value.

**Stackoverflow example that will help:**
(https://stackoverflow.com/questions/925780/remove-characters-from-nsstring)

**Twitter Documentation Explanation on the profile image size values:**
(https://developer.twitter.com/en/docs/accounts-and-users/user-profile-images-and-banners)

</details>
<br>

<details>
<summary style="font-size:1.25em; font-weight: 600"> Are you having trouble accessing the `media_url_https` value that is inside the Media Dictionary to display embedded images? </summary>


The Media dictionary in the Twitter API is similar to the movie dictionary we dealt with in the Flix App but it *differs* in one small unique aspect. According to the Twitter Documentation, this dictionary is only present when there is Media present in the Tweet Object. This makes sense right? There is no need to return an **NSDictionary** if there is no value inside it. With this hint in mind, remember how we got the movie titles out of the movie dictionary from Flix. You just have to make sure before accessing the `media_url_https` that the `NSDictionary *media` is present with values.

**Twitter Documentation reference:**
(https://developer.twitter.com/en/docs/tweets/data-dictionary/overview/entities-object)
> * The note in documentation that can be looked past is that media and polls entities will only appear when that type of content is part of the Tweet.

</details>
<br>

<details>
<summary style="font-size:1.25em; font-weight: 600"> Are your tabbed view controllers trying to present modally (like a card) instead of Full Screen?  </summary>

In the right panel menu in the Simulated Metrics tab, there contains a presentation drop down menu. You can change the presentation of your view controller to be **Full Screen** like image provided:
![](https://i.imgur.com/Vupdr1V.png)

</details>
<br>

<details>
<summary style="font-size:1.25em; font-weight: 600"> Having trouble with **TTTAttributedLabel** or want to detect #Hashtags and @mentions too? </summary>

There are also many other Cocoa Pod frameworks that exist on the internet. Here are a few that were mentioned by students below:

Try **ResponsiveLabel**:
**CocoaPod ResponsiveLabel Doc:**
(https://cocoapods.org/pods/ResponsiveLabel)

*May be deprecated already (will delete if so)*
**CocoaPod STTweetLabel Doc:**
(https://cocoapods.org/pods/STTweetLabel)

</details>
<br>

<details>
<summary style="font-size:1.25em; font-weight: 600"> Understanding block syntax </summary>

Check this link out for understanding block syntax! http://goshdarnblocksyntax.com/

</details>
<br>

<details>
<summary style="font-size:1.25em; font-weight: 600"> Are you getting a Forbidden 403: error when you are passing in a large tweet? </summary>

Did you check to make sure your tweet is not at the max character limit? Please make sure to check the Twitter API Documentation to see what is the maximum character count is.

</details>
<br>

<details>
<summary style="font-size:1.25em; font-weight: 600"> Have you refreshed your API Key and now you are blocked out of your app? </summary>

Are you using UserDefaults to store this? You need to clear your cache in simulator! 

</details>
<br>

<details>
<summary style="font-size:1.25em; font-weight: 600"> Are you having trouble getting each user profile when you tap on the profile image tap gesture recognizer? </summary>


This is a hint for the following User Stretch Story: 
* *User can tap the profile image in any tweet to see another user's profile*

It is strange right? Why is it that the user segues over to a profile view from any row in the cell and it always returns back the `indexPath.row` as 0. Are you setting your user object in the protocal method in the TimelineViewController so it knows which user to pass in as the parameter? 
![](https://i.imgur.com/DhkPrnJ.png)


</details>
<br>


<details>
<summary style="font-size:1.25em; font-weight: 600"> Cannot access the reply_count value in the tweet?  </summary>

As mentioned in the iOS Technical Forum Group On Workplace, this is a property that is only accessible to Premium Developer accounts. It is fine to not include it. 

*It was found by another student that the reply thread is also a premium account accessibly property.* I would like to share this so you can see what you may not have access to.

**Twitter API Tiers**
(https://developer.twitter.com/en/premium-apis)

</details>
<br>


<details>
<summary style="font-size:1.25em; font-weight: 600"> How do you get your own Profile? I want my user info? </summary>

There is an API you should DEFINITELY look into. 

**Twitter Documentation**
https://developer.twitter.com/en/docs/accounts-and-users/manage-account-settings/api-reference/get-account-verify_credentials


</details>
<br>


<details>
<summary style="font-size:1.25em; font-weight: 600"> Why am I not able to see my tweet text body anymore when I use `tweet_mode=extended` to expand my tweet body ? </summary>

When you use `tweet_mode=extended`, the key for the tweet body in Tweet dictionary becomes `full_text`
When you do not use the above ^, then you have the key for the tweet body as `text`

There becomes a mismatch if you don't apply the `tweet_mode=extended` query parameter in every API that returns back the Tweet object so make sure to set break points in the Tweet.m file to make sure the dictionary is setting the tweet body properly. The tweet is not disappearing, you are just calling the incorrect key in dictionary.


</details>
<br>

<details>
<summary style="font-size:1.25em; font-weight: 600"> Want cleaned up assets that are transparent backgrounds?  </summary>

Re-download the assets on the portal --> we have since updated them to support dark mode :) 

</details>
<br>



