Jasonette / Jasonette/JASONETTE-iOS

Supporting capabilities (such as push notification) without headache

Open
#53 13 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
5.2k
Forks
347
PR merge metrics
No merged PRs in 30d

Description

There are some features you can only use in your apps once you enable from XCode's "capabilities" tab. This includes push notification, iCloude, Apple Pay, In app purchase, etc. Here's what it looks like in XCode:

![screen shot 2016-11-16 at 6 10 27 pm](https://cloud.githubusercontent.com/assets/16613330/20369609/0008771e-ac28-11e6-8ea0-7d588d8c61f2.png)

Currently we have two features that requires turning on capabilities--Map and Push Notifications. For maps, turning it on doesn't make a huge difference.

However for most other capabilities--including push notifications--it's not that simple. When you turn on a push notification feature, it adds an "entitlements" file to the project. But that's not all. I think there are [more things going on behind the scenes than just this entitlements file](https://developer.apple.com/library/content/documentation/IDEs/Conceptual/AppDistributionGuide/AddingCapabilities/AddingCapabilities.html).

As an example, see this part (where it says "In your developer account, the Push Notifications service will appear as Configurable (not Enabled) until you create a client SSL certificate."):

![screen shot 2016-11-16 at 6 21 44 pm](https://cloud.githubusercontent.com/assets/16613330/20369887/93b0e6a8-ac29-11e6-862c-ca7b20749464.png)

If I'm interpreting this correctly, we can't just turn on these capabilities in the master branch and distribute it as open source because turning it on in XCode is not just a matter of adding a new file or setting a config, but it actually changes the things on the Apple developer account backend side.

## What's wrong with just distributing without turning these capabilities on?
We could just keep these turned off and let people turn them on only if they want to implement them. And I think that's totally a fine approach. For example, have push notifications turned off by default, and let people enable them through XCode.

The problem is, even with the capabilities are off there's still push related code in there (such as registering for notification and acquiring device token etc.), so when you submit to the appstore, Apple gives you an error saying that you need to either:

1. turn on the push notification capability
2. or delete your push related code altogether.

This is confusing for users https://github.com/Jasonette/JASONETTE-iOS/issues/25#issuecomment-259703253 and I think we need to fix this before merging to master.

## Ideas?
I've been researching this and asking around but couldn't find a clean solution. Maybe there's a way to conditionally compile/build code depending on which capabilities to support, so the push related code will not be included in the final build if people don't implement push? Anyone know how to deal with this type of problem?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing push-notification registration and device-token code, then compare the Xcode capabilities and Apple App Store requirements described in the issue. Done would require an agreed approach for optional capabilities that prevents invalid submissions without confusing users.

Written by the indexing model from the issue text.

Assessment

Tech stack
ios
Domain
mobile
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.