Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

iOS capabilities?

Discussion in 'Unity Build Automation' started by samjoly, Jan 20, 2016.

  1. samjoly

    samjoly

    Joined:
    Apr 23, 2013
    Posts:
    29
    Hey team it seems that the Cloud doesn't include the iOS Notification capabilities (That I normally set in Xcode)? Is it right? Or something wrong in my code?

    Thanks!
     
  2. dannyd

    dannyd

    Unity Technologies

    Joined:
    Jun 3, 2014
    Posts:
    785
    Like push notifications? What changes are you having to make in Xcode? As long as your provisioning profile has the correct entitlements it should work. Unless you have some plugins that require adding frameworks - in that case read this thread about using Xcode Manipulation API to add frameworks to your Xcode project at build time: http://forum.unity3d.com/threads/ios-build-errors-from-missing-libraries.318494/
     
  3. samjoly

    samjoly

    Joined:
    Apr 23, 2013
    Posts:
    29
    Thanks Danny for your quick response!
    Yes I'm using push notifications. In Xcode, in capabilities I'm checking On Push Notification (see screen capt).
    I rechecked the App ID manager in Apple Dev, and I can see that Push notification is set on Configurable (see screen capt). Any idea?

    BTW, thanks for the link, I think that I have all the library in my current case, but it's really good to know that it can be done this way.

    Sam
     

    Attached Files:

  4. dannyd

    dannyd

    Unity Technologies

    Joined:
    Jun 3, 2014
    Posts:
    785
    Ya that setting in Xcode is just because it tries to manage your provisioning profiles for you. On the apple dev site you need to make sure that push notifications are enabled for the ad-hoc provisioning profile you want to use. After making updates to the profile you will need to download it and re-upload it to cloud build for your project.
     
  5. samjoly

    samjoly

    Joined:
    Apr 23, 2013
    Posts:
    29
    You nailed it Danny. I was in dev profile, when I need to be in the ad-hoc provisioning. It works now.
    I still have some issue, but it's more Xcode and iOS stuff, that I need to figure out. Unity Cloud did its job.
    Thanks again!
     
    Last edited: May 6, 2016
  6. BlackFly

    BlackFly

    Joined:
    Mar 24, 2015
    Posts:
    5
    Hey guys,
    I'm trying to setup apple push notifications from AWS SNS to a unity cloud build. I'm hitting the same issue Samjoly did back in January but unfortunately haven't been able to get my certificates properly sorted out. Everything works as expected from my local Xcode build (which offers the convenient "Push Notifications enabled" option.

    I'm still in development with only a handful of devices for testing. Would someone be willing to recommend what certs I need to create in what order?

    I believe I want the following:
    • Certificate: Production - App Store & Ad Hoc
    • Certificate: Production - Apple Push Notification service SSL (Sandbox & Production)
    • App ID - w/ Push Notifications enabled (Distribution only?)
    • Provisioning Profile - Distribution Ad Hoc
    Any suggestions?

    Thanks,
    James
     
  7. samjoly

    samjoly

    Joined:
    Apr 23, 2013
    Posts:
    29
    Hi James,
    If my memory is good you, for the cloud to include the push certificate, you need to have your certificate to Ad Hoc in your cloud setting. It seems that dev certificate doesn't work with push on the cloud.

    For me the "Push Notifications enabled" button in xcode just confused me. You should focus to have the certificate right.

    Keep me posted.
     
  8. AtomicElbow

    AtomicElbow

    Joined:
    Aug 11, 2016
    Posts:
    13
    Hi, I have the same problem. Push notifications doesn't work when installing iOS from Cloud Build. I have made a post build script to add frameworks etc to make it build, and it feels like the only thing missing from that script (compared to when building manually, when push works) is switching the "Push notifications" capability setting to "On". I don't know why it seems to be "off" by default, in Xcode..

    No ideas about how to enable it using the PBXProject stuff ? Push is enabled in Apple dev portal from what I can see..
     
  9. tenjik11

    tenjik11

    Joined:
    Jul 2, 2015
    Posts:
    7
    I added push notification to my iOS build. If I do a local build, everything works fine. However, when I try to do the build in Unity Cloud Build, the build process completes but I cannot install the app on my iOS device. Once the app is completely downloaded, and pop say the app cannot be installed"
    The provisioning profile has Push Notification enable and has a developer and distribution push notification certificate attached.
    I use PBXProject to set up all the project after the build calling the PostProcess Unity cloud method. When I check the settings in XCode, Push Notifications is enable and everything looks fine.
     
  10. dannyd

    dannyd

    Unity Technologies

    Joined:
    Jun 3, 2014
    Posts:
    785
  11. andersemil

    andersemil

    Joined:
    Feb 2, 2015
    Posts:
    107
    Same here, if I do a local build everything works fine, if I try to submit an .ipa from Unity Cloud Build, I get a warning from Apple saying there's no push notification entitlement in the build, even though I'm using the exact same provisioning profile. It's rather annoying because we release updates to our games frequently and using cloud build saves me at least 20 minutes every time I have to submit.
     
  12. andersemil

    andersemil

    Joined:
    Feb 2, 2015
    Posts:
    107
    The weird thing is, that even though Apple complains about the missing entitlement, push notifications still seem to work on a TestFlight install.
     
  13. LOLinc

    LOLinc

    Joined:
    Nov 18, 2013
    Posts:
    28
    We seem to have the same problem. We use the onesignal service for push and if we do a local build were we manually enable the needed capabilities (push and background modes), no frameworks to add, all is good. But using a cloud build where we cannot enable the capabilities manually push doesn't work.
    We are using an Ad Hoc profile with push enabled for our cloud builds.
     
  14. JKasten

    JKasten

    Joined:
    Apr 11, 2013
    Posts:
    23
    @dannyd What version of XCode does Unity Cloud build use? Xcode 8 now requires more than just "Push Notifications" enabled on the provisioning profile.

    For clarification it is this setting in XCode
    upload_2017-1-10_20-17-7.png


    When this is checked it will create the following sections in project.pbxproj
    Code (csharp):
    1. SystemCapabilities = {
    2.    com.apple.Push = {
    3.       enabled = 1;
    4.    };
    5. }
    Code (csharp):
    1. buildSettings = {
    2.    CODE_SIGN_ENTITLEMENTS = ProjectName.entitlements;
    3. }
    The .entitlements file should then contain the following.
    Code (csharp):
    1. <dict>
    2.     <key>aps-environment</key>
    3.     <string>development</string>
    4. </dict>
    development could also be production.

    Can you confirm if this is being set by Unity Cloud builds when the provisioning profile has "push notifications" enabled on it? If it doesn't not automatically detect and set this automatically (local builds do not) then is it possible with your Editor PBXProject API with a single setting? I don't see a simple toggle for "Push Notifications" capabilities so it would seem each one of the entries above would have to added manually.
     
  15. andersemil

    andersemil

    Joined:
    Feb 2, 2015
    Posts:
    107
    @JKasten it is not set by Unity Cloud Build last I checked a month ago. I cannot submit release builds from cloud build, I HAVE to do it manually because of this. Very annoying.
     
  16. spothieux

    spothieux

    Joined:
    Sep 20, 2015
    Posts:
    9
    @JKasten i have the same problem with the push notification.

    My AdHoc profile is tagged push notification.
    If i try in a local build in Xcode with my AdHoc profile (not auto profile) and set the PushNotification to On, my notification is working.
    If i use CloudBuild with the same profile i have an error (Other Apns 3000 Error).

    It seems that the auto settings of PushNotification in Xcode does not work in the cloud build.

    If you cannot detect the functionnality in the profile may be you can add a setting into Unity to set it by default.
     
  17. seno

    seno

    Joined:
    Aug 5, 2010
    Posts:
    17
    Hi, guys.

    I recently encountered same problem for using OneSignal. Taking @JKasten advice as final piece, I managed to make iOS build with UnityCloudBuild.

    And, I would like share the code snippets with you.

    https://bitbucket.org/snippets/Eyeoness/eaong

    The code snippets is not organized well but if you follow method calls, I am sure you can understand
    how to handle the problem.

    If you have questions about the snippets, feel free to ask.

    Cheers!
     
  18. QuantumCalzone

    QuantumCalzone

    Joined:
    Jan 9, 2010
    Posts:
    262
    Got push notifications to work in UCB via this post might help with other capabilities
     
    a_p_u_r_o likes this.