How to Handle Oauth-Style Log Ins with Imessage Apps in iOS 10, Xcode 8

launch containing app from iOS8 Custom Keyboard

To answer MY OWN question:

In an iOS8 custom keyboard, the extensionContext object is nil, thus I can't use it to launch the containing app.

The workaround I came up with is:

  1. create a url scheme for your app
  2. add a UIWebView to your inputView
  3. load the url scheme for your containing app in the webview

I'm not sure if Apple will allow this to happen, but it works now.

UILabel with custom font displays *wrong* custom font

UIFont is limited to two variations per font family. However, you can work around this by opening the additional n-2 fonts in an editor and changing the family name.

Answered my own question about this here: UIFont fontWithName: limited to loading 2 variations per family

django swift login system

My qualifications for this answer come from 3 months of work on an identical system to the one you described. Your question holds many parts, so I will begin with the server.

From what I have gathered from research - I will have to make REST
calls to an API created from the existing django app.

Correct, your clients (app, web, or otherwise) should communicate with your server through an API.

I have a django web app created already, with a simple user table
(username/password).

Hopefully your "simple user table" uses the default Django user model, as 3rd party security frameworks are going to make your life much simpler when protecting an open API. Although it depends on your security needs, I recommend the Django OAuth Toolkit for its OAuth2 support, password reset workflow, and prebuilt URL endpoints for common authentication interactions. Even better, this library natively supports the Django Rest Framework.

Would it be better to use TastyPie or Django Rest Framework for this?

I do not have experience with TastyPie, however I can vouch for DRF. The generic views matched our major API design points well, and DRF's similarities to the Django Form API means our custom dashboard has a wonderful symmetry to the API. I recommend you first map out the major components of your API, then research both frameworks to learn which will fit your project best.

(Bonus Tip: If this is your first time designing a REST API, flip through a copy of Build APIs You Won't Hate)

Also, what would be the url that i use for the rest calls, would it be
the existing server that the django web app is on?

Common practice is to host your API URLs on a subdomain, followed by a version path, such as api.example.com/v1/. The subdomain separates your URLs from core web pages and denotes these endpoints are specifically for your API. The version path is a good practice to support legacy APIs as you upgrade.

Are there specific things I have to keep in mind when doing the API
for the django app?

Security is a big one. Depending on your API, there could be some sensitive parts of your application exposed to the public. Write tests to ensure you are not poking new holes in your security, and leave OAuth to the pros. Other than that, make sure your server is ready to handle your traffic, and spend plenty of time perfecting your model.

I also have an iOS app (swift) set up, and was wondering what would be
the best way to go about coding the login system?

When coding client-side, always use best practices to retrieve and store credentials. Communicate with your server over SSL, store only what you need, and destroy the expected data when a user logs out. Remember, if your app stores usernames and passwords, it stores sensitive data (because people have a funny tendency to reuse passwords for important things). Finally, clearly communicate the login process to your users with helpful error messages and loading animations. As you can see by now, the login process is fairly complex, but if executed well it will feel effortless.



Related Topics



Leave a reply



Submit