Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by greglieb · Apr 12, 2020 at 09:25 AM · iosbuildunityeditorxcode

Unity Mobile Notifications does not add Push Notification Capability to XCode Project

My Unity 2019.3 project is using the Unity Mobile Notifications library, version 1.0.3

 using Unity.Notifications.iOS;

According to the Player Settings iOS documentation, the "Automatically add capabilities" option (when checked) should add the "Push Notifications" capability to my XCode project. I do not see this behavior occurring.

I tried including the legacy system in my code to nudge the "Automatically add capabilities" feature. No effect.

 Debug.Log(UnityEngine.iOS.NotificationServices.deviceToken);

I tried adding the capability with a post-build script. No effect.

 public void OnPostprocessBuild(BuildReport report)
 {
     if (report.summary.platform != BuildTarget.iOS) return;
     var file_name = "gamename.entitlements";
     var buildPath = report.summary.outputPath;
     var proj_path = PBXProject.GetPBXProjectPath(buildPath);
     Debug.Log("proj_path: " + proj_path);

     var proj = new PBXProject();
     proj.ReadFromFile(proj_path);

     var target_name = "Unity-iPhone";
     var target_guid = proj.GetUnityMainTargetGuid();
   
     string entitlementsFilePath = target_name + "/" + file_name;
     var capManager = new ProjectCapabilityManager(proj_path, entitlementsFilePath, target_name, target_guid);
     capManager.AddPushNotifications(development: false);
     capManager.WriteToFile();  
 }

I have noticed that there are two entitlement files: "Entitlements.entitlements", and "gamename.entitlements".

"Entitlements.entitlements" has a single entry for SignInWithApple that IS added to the XCode project Capabilities. "gamename.entitlements" has a single entry for APS Environment that IS NOT added to the XCode project Capabilities.

I suspect these files have something to do with this madness. Please help.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by cmersereau · Mar 18, 2021 at 07:45 PM

See my comment here

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by greglieb · Mar 19, 2021 at 07:15 AM

Thanks. Those troubleshooting steps plus deleting and rebuilding my XCode project fixed it.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image cmersereau · Mar 19, 2021 at 02:12 PM 0
Share

I figured it's been so long it wasn't an issue for you anymore. Just wanted to help with anybody else who found this post in their search for an answer.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

171 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Xcode DebugFocusItem 0 Answers

Unity edit UnityAppController.mm when build iOS 0 Answers

IOS append not working? 0 Answers

Xcode build fails, How to ? 1 Answer

Documentation of code generated by unity for iOS 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges