블로그 이미지
Every unexpected event is a path to learning for you.

카테고리

분류 전체보기 (2737)
Unity3D (817)
Programming (474)
Server (33)
Unreal (4)
Gamebryo (56)
Tip & Tech (228)
협업 (58)
3DS Max (3)
Game (12)
Utility (136)
Etc (96)
Link (32)
Portfolio (19)
Subject (90)
iOS,OSX (53)
Android (14)
Linux (5)
잉여 프로젝트 (2)
게임이야기 (3)
Memories (20)
Interest (38)
Thinking (38)
한글 (30)
PaperCraft (5)
Animation (408)
Wallpaper (2)
재테크 (18)
Exercise (3)
나만의 맛집 (3)
냥이 (10)
육아 (16)
Total
Today
Yesterday
04-20 00:00

hello,

From that post : http://forum.unity3d.com/threads/how-can-you-add-items-to-the-xcode-project-targets-info-plist-using-the-xcodeapi.330574/ by modifying a bit the script i got that :

     [PostProcessBuild]
     public static void ChangeXcodePlist(BuildTarget buildTarget, string pathToBuiltProject) 
     {  
         if (buildTarget == BuildTarget.iOS) 
         {
             // Get plist
             string plistPath = pathToBuiltProject + "/Info.plist";
             PlistDocument plist = new PlistDocument();
             plist.ReadFromString(File.ReadAllText(plistPath));
             
             // Get root
             PlistElementDict rootDict = plist.root;
             
             // Change value of CFBundleVersion in Xcode plist
             var buildKey = "UIBackgroundModes";
             rootDict.CreateArray (buildKey).AddString ("remote-notification");
             
             // Write to file
             File.WriteAllText(plistPath, plist.WriteToString());
         }
     }

 

i just did it, it seems to work, need further test though.

Edit : Note that the script should be in Assets/Editor folder. Edit 2 : i created i string it should be a array, i changed the code.

 

[출처] https://answers.unity.com/questions/1066927/postprocessing-ios-activate-background-mode-for-pu.html

 

PostProcessing iOS Activate Background Mode for Push Notifications - Unity Answers

 

answers.unity.com

 

반응형
Posted by blueasa
, |

[사용도구]

Unity 5.6.7

Xcode 10.2.1

 

최근 iOS빌드에서 XCode-Capabilities-Push Notifications를 수동으로 ON 시켜야 되는 문제가 귀찮아서 자동으로 하는 방법을 찾아보고 정리해둠.

(유니티 5.x에서 되는 방법을 찾느라 이래저래 삽질을..)

 

[순서]

1) https://bitbucket.org/Unity-Technologies/xcodeapi 소스 다운로드.

 

2) 다운로드 받은 소스를 유니티 해당 프로젝트의 Editor 폴더 아래 추가

   나의 경우는 ../Assets/Editor/XCodeApi 아래에 추가. 

   2-1) Xcode.Tests는 에러나서 제거 함.(2017 이후 버전 API를 사용하는 듯 함)

 

3) iOS PostProcessBuild 소스에 PBXCapabilityType.PushNotifications 추가(AddCapability)

using System.IO;
using UnityEngine;
using UnityEditor;
using UnityEditor.iOS.Xcode;
using UnityEditor.Callbacks;
using System.Collections;

public class XCodeSettingsPostProcesser
{

    [PostProcessBuild]
    public static void OnPostprocessBuild(BuildTarget buildTarget, string pathToBuiltProject)
    {
        // Stop processing if targe is NOT iOS
        if (buildTarget != BuildTarget.iOS)
        {
            return;
        }

            /// Initialize PbxProject
            var projectPath = PBXProject.GetPBXProjectPath(pathToBuiltProject);
            PBXProject pbxProject = new PBXProject();
            pbxProject.ReadFromFile(projectPath);
            // Unity 2019 대응
#if UNITY_2019_3_OR_NEWER
            //string targetGuid = pbxProject.GetUnityFrameworkTargetGuid();
            string strMainTargetGuid = pbxProject.GetUnityMainTargetGuid();
            string strFrameworkTargetGuid = pbxProject.GetUnityFrameworkTargetGuid();
#else
            string targetGuid = pbxProject.TargetGuidByName("Unity-iPhone");
#endif

        // Add push notifications as a capability on the target
        pbxProject.AddCapability(targetGuid, UnityEditor.iOS.Xcode.Custom.PBXCapabilityType.PushNotifications);

        // Apply settings
        File.WriteAllText(projectPath, pbxProject.WriteToString());
    }
}

    3-1) 주의사항

         기존 PBXProjectUnityEditor.iOS.Xcode.PBXProject인데, 추가 된 플러그인을 사용하기 위해 UnityEditor.iOS.Xcode.Custom.PBXProject로 변경필요.

         예1) UnityEditor.iOS.Xcode.PBXProject -> UnityEditor.iOS.Xcode.Custom.PBXProject

         예2) UnityEditor.iOS.Xcode.PBXCapabilityType -> UnityEditor.iOS.Xcode.Custom.PBXCapabilityType

 

4) entitlements 생성을 위해 아래 클래스를 Editor 폴더에 추가

    (entitlements 파일 내용을 스크립트 내부에 넣어서 생성해서 별도의 파일 추가를 안해도 돼서 편한 듯)

using UnityEditor;
 using UnityEditor.Callbacks;
 using UnityEngine;
 using System.IO;
 using UnityEditor.iOS.Xcode;
 
 public class EntitlementsPostProcess
 {
     private const string entitlements = @"
     <?xml version=""1.0"" encoding=""UTF-8\""?>
     <!DOCTYPE plist PUBLIC ""-//Apple//DTD PLIST 1.0//EN"" ""http://www.apple.com/DTDs/PropertyList-1.0.dtd"">
     <plist version=""1.0"">
         <dict>
             <key>aps-environment</key>
             <string>development</string>
         </dict>
     </plist>";
     
     [PostProcessBuild]
     public static void OnPostProcess(BuildTarget buildTarget, string buildPath)
     {
         if (buildTarget != BuildTarget.iOS) return;
 
         var file_name = "unity.entitlements";
         var proj_path = PBXProject.GetPBXProjectPath(buildPath);
         var proj = new PBXProject();
         proj.ReadFromFile(proj_path);
 
         // target_name = "Unity-iPhone"
         var target_name = PBXProject.GetUnityTargetName();
         var target_guid = proj.TargetGuidByName(target_name);        
         var dst = buildPath + "/" + target_name + "/" + file_name;
         try
         {
             File.WriteAllText(dst, entitlements);
             proj.AddFile(target_name + "/" + file_name, file_name);
             proj.AddBuildProperty(target_guid, "CODE_SIGN_ENTITLEMENTS", target_name + "/" + file_name);
             proj.WriteToFile(proj_path);
         }
         catch (IOException e)
         {
             Debug.LogWarning($"Could not copy entitlements. Probably already exists. ({e})");
         }
     }
 }

 

[1) 참조] https://bitbucket.org/Unity-Technologies/xcodeapi

 

Bitbucket

 

bitbucket.org

[3) 참조] https://qiita.com/fullcorder/items/b82c48022acd0b4ff957

 

Unity5のPostProcessBuildでXcode Capabilityの設定する方法 - Qiita

XcodeのCapabilityの各種設定を`PostProcessBuild`で行う方法です。 Pushの設定などを有効にするアレです。 # ざっくり流れ ### In-App Purchaseなどentitlementsフ...

qiita.com

[4) 참조] https://answers.unity.com/questions/1224123/enable-push-notification-in-xcode-project-by-defau.html

 

Enable Push Notification in XCode project by default? - Unity Answers

 

answers.unity.com

 

반응형
Posted by blueasa
, |

[링크]

http://naver.me/FIj7Ocof

 

취학전 월3만원미만 육아] 2.아이를 키운다면 반드시 봐야 할 감정코치 동영상 정리

[BY 봄이네가족] 아이가 정말 행복하게 잘 자리길 바란다면, 반드시 보아야 할 감동적인 영상입니다. 좋...

m.post.naver.com

 

반응형
Posted by blueasa
, |

XcodeのCapabilityの各種設定をPostProcessBuildで行う方法です。
Pushの設定などを有効にするアレです。

ざっくり流れ

In-App Purchaseなどentitlementsファイルが不要なcapabilityの場合

  1. Unityのリポジトリから, 最新のXcode Manipulation API(以下Xcode API)を持ってくる
  2. 既存のプロジェクトにインポートできるように修正する
  3. 最新のAPIでPostProcessBuildのScriptを書く

iCloudなどentitlementsファイルが必要なcapabilityの場合

  1. 一旦先にビルドしてXcodeProjectを作成する
  2. capabilityを設定し, entitlementsファイルを作成する
  3. PostProcessBuildでentitlementsファイルとビルドプロパティを追加する
  4. 以後entitlements file不要な場合に合流する

詳細な流れ

entitlementsファイルのいらないcapabilityの場合

Unityのリポジトリから, 最新のXcode APIを持ってくる

  • リポジトリ内のXcodeフォルダをデスクトップなど作業環境にコピーします
  • ターミナルでXcodeディレクトリに移動し, 下記のコマンドでC#のソースコードのnamespaceを変更します.仮に変更後のnamespaceをUnity2017.iOS.Xcodeとします

 

$ pwd
Users/fullcorder/Desktop/Xcode 
$ find . -name '*.cs' | xargs sed -i "" 's/UnityEditor.iOS.Xcode/Unity2017.iOS.Xcode/g'

 

  • Xcode/Propertiesディレクトリをは不要なので削除します
  • UnityプロジェクトのEditorディレクトリにXcodeフォルダごとインポートします

PostProcessBuildスクリプトを作成し下記のようにPBXProject#AddCapabilityを使って追加します

Unity2017.1のリファレンス
https://docs.unity3d.com/2017.1/Documentation/ScriptReference/iOS.Xcode.PBXProject.AddCapability.html

 

[PostProcessBuild]
public static void AddCapability(BuildTarget buildTarget, string path)
{
    if(EditorUserBuildSettings.activeBuildTarget != BuildTarget.iOS)
    {
        return;
    }

    string projPath = path + "/Unity-iPhone.xcodeproj/project.pbxproj";

    var proj = new PBXProject();
    proj.ReadFromString(File.ReadAllText(projPath));

    string target = proj.TargetGuidByName(TargetGroup);

    proj.AddCapability(target, PBXCapabilityType.PushNotifications);
    proj.AddCapability(target, PBXCapabilityType.InAppPurchase);

    File.WriteAllText(projPath, proj.WriteToString());
}

 

  • 以上ですあとはビルドすればOKです

entitlementsファイルが必要なcapabilityの場合

entitlementsファイルが必要な場合は, entitlementsファイルを作成したものをPostProcessBuildで追加し、あとはentitlementsファイルが不要な場合に合流します

entitlementsファイルを作成

  • UnityでiOSビルドしてXcodeProjectを吐き出します
  • Capabilityタブに行き, Pushなどをこうなりたい状態, PostProcessBuild後で設定後の形にします
  • entitlementsファイルがXcodeプロジェクト内に作成されるので取り出してUnityProjectにインポートします
  • Unityフォーラムの下記ポストからEntitlementsPostProcess.csをDLしてUnityにインポートします

https://forum.unity3d.com/threads/how-to-put-ios-entitlements-file-in-a-unity-project.442277/

  • EntitlementsPostProcess.csのSerializeFieldであるEntitlements Fileにentitlementsファイルを設定します
  • 以上でentitlementsファイル追加が完了します

以後、前述の手順と合わせてビルドすると無事, 設定反映したになっていると思います
(Plist編集は別途スクリプト書いてください)

その他

Unity2017からは多分使えるAPIなので、長いプロジェクトの場合, プラットフォーム依存コンパイルでUnity5のみ限定して今回変更したnamespaceを使うようにすると良いと思います。

環境

macOS Sierra
Unity 5.5.3f1
Xcode 8.3.2

参考 
https://bitbucket.org/Unity-Technologies/xcodeapi
https://forum.unity3d.com/threads/how-to-put-ios-entitlements-file-in-a-unity-project.442277/

 

 

[출처] https://qiita.com/fullcorder/items/b82c48022acd0b4ff957

 

Unity5のPostProcessBuildでXcode Capabilityの設定する方法 - Qiita

XcodeのCapabilityの各種設定を`PostProcessBuild`で行う方法です。 Pushの設定などを有効にするアレです。 # ざっくり流れ ### In-App Purchaseなどentitlementsフ...

qiita.com

 

반응형
Posted by blueasa
, |

I manage to get it working by a C# script, but since this build setting need an .entitlementfile in your xcode project, first you will need to create a text file called [projectName].entitlement anywhere in your project with this content:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  3. <plist version="1.0">
  4. <dict>
  5. <key>aps-environment</key>
  6. <string>development</string>
  7. </dict>
  8. </plist>

Now you can add this script on the Editor folder:

  1. using System.IO;
  2. using JetBrains.Annotations;
  3. using UnityEditor;
  4. using UnityEditor.Callbacks;
  5. using UnityEditor.iOS.Xcode;
  6. using UnityEngine;
  7.  
  8. public class PostProcessBuildScript : ScriptableObject
  9. {
  10. public DefaultAsset entitlementsFile;
  11.  
  12. [PostProcessBuild, UsedImplicitly]
  13. public static void ChangesToXcode(BuildTarget buildTarget, string pathToBuiltProject)
  14. {
  15. // Get project PBX file
  16. var projPath = PBXProject.GetPBXProjectPath(pathToBuiltProject);
  17. var proj = new PBXProject();
  18. proj.ReadFromString(File.ReadAllText(projPath));
  19. var target = proj.TargetGuidByName("Unity-iPhone");
  20.  
  21. // Create an instance of this ScriptableObject so we can point to its entitlements file
  22. var dummy = CreateInstance<PostProcessBuildScript>();
  23. var entitlementsFile = dummy.entitlementsFile;
  24. DestroyImmediate(dummy);
  25. if (entitlementsFile != null)
  26. {
  27. // Copy the entitlement file to the xcode project
  28. var entitlementPath = AssetDatabase.GetAssetPath(entitlementsFile);
  29. var entitlementFileName = Path.GetFileName(entitlementPath);
  30. var unityTarget = PBXProject.GetUnityTargetName();
  31. var relativeDestination = unityTarget + "/" + entitlementFileName;
  32. FileUtil.CopyFileOrDirectory(entitlementPath, pathToBuiltProject + "/" + relativeDestination);
  33.  
  34. // Add the pbx configs to include the entitlements files on the project
  35. proj.AddFile(relativeDestination, entitlementFileName);
  36. proj.AddBuildProperty(target, "CODE_SIGN_ENTITLEMENTS", relativeDestination);
  37.  
  38. // Add push notifications as a capability on the target
  39. proj.AddBuildProperty(target, "SystemCapabilities", "{com.apple.Push = {enabled = 1;};}");
  40. }
  41.  
  42. // Save the changed configs to the file
  43. File.WriteAllText(projPath, proj.WriteToString());
  44. }
  45. }

After that you just define the entitlementsFile variable for the script in the inspector window and you should now have the push notification activated by default when you build for iOS.

 

 

 

[출처] https://answers.unity.com/questions/1224123/enable-push-notification-in-xcode-project-by-defau.html

 

Enable Push Notification in XCode project by default? - Unity Answers

 

answers.unity.com

 

반응형
Posted by blueasa
, |

Unity에서 Firebase Cloud Messaging(FCM) 서비스 적용 후 빌드 시, 애플로부터 Missing Push Notification Entitlement 메시지를 받을 때가 있는데 어느 순간 부터 XCode에서 Capabilities-Push Notifications를 수동으로 ON 시켜줘야 된단다.

 

 

[참조]

7단계: 사용자 알림 프레임워크 추가

  1. Xcode 프로젝트를 클릭한 후 Editor area(편집 영역)에서 General(일반) 탭을 클릭합니다.

  2. Linked Frameworks and Libraries(연결된 프레임워크 및 라이브러리)까지 아래로 스크롤한 다음 + 버튼을 클릭하여 프레임워크를 추가합니다.

  3. 나타나는 창에서 UserNotifications.framework까지 스크롤하여 해당 항목을 클릭한 다음 Add(추가)를 클릭합니다.

8단계: 푸시 알림 사용 설정

  1. Xcode 프로젝트를 클릭한 후 Editor area(편집 영역)에서 Capabilities(기능) 탭을 클릭합니다.

  2. Push Notifications(푸시 알림)를 On(켜기)으로 전환합니다.

  3. Background Modes(백그라운드 모드)까지 아래로 스크롤하고 On(켜기)으로 전환합니다.

  4. Background Modes(백그라운드 모드)아래의 Remote notifications(원격 알림) 체크박스를 선택합니다.

 

[출처] https://firebase.google.com/docs/cloud-messaging/unity/client?hl=ko

 

Unity로 Firebase 클라우드 메시징 클라이언트 앱 설정  |  Firebase

Unity로 교차 플랫폼 Firebase 클라우드 메시징 클라이언트 앱을 작성하려면 Firebase 클라우드 메시징 API를 사용하세요. Unity SDK는 Android 및 iOS에서 모두 작동하며 플랫폼에 따라 몇 가지 추가 설정이 필요합니다. 시작하기 전에 1단계: 환경 설정 Unity 5.3 이상을 설치합니다. (iOS만 해당) 다음에 대한 액세스 권한이 있어야 합니다. Xcode 9.4.1 이상 CocoaPods 1.4.0 이상 Unity 프로젝

firebase.google.com

 

반응형
Posted by blueasa
, |

https://www.draw.io/

여기 들어가서 그리면 된다 ㅎㅅㅎ XML으로 저장해두고, 나중에 재수정해서 쓸 수도 있다. 

 

요런식으로 그려다가 쓰면 된다 ㅎㅅㅎ 

 

 

 

<끝>



출처: https://americanopeople.tistory.com/278 [복세편살]

 

(Draw.io) 온라인 다이어그램 툴

https://www.draw.io/ 여기 들어가서 그리면 된다 ㅎㅅㅎ XML으로 저장해두고, 나중에 재수정해서 쓸 수도 있다. 요런식으로 그려다가 쓰면 된다 ㅎㅅㅎ <끝>

americanopeople.tistory.com

 

반응형
Posted by blueasa
, |

[링크]

https://velog.io/@city7310/%EB%82%B4%EA%B0%80-%EA%B3%B5%EB%B6%80%ED%95%98%EB%8A%94-%EB%B0%A9%EC%8B%9D

 

내게 실용적이었던 프로그래밍 공부 방법들

나는 보통 재능이나 공부의 양으로 친구들의 성장 속도를 따라가기 힘들었다. 그래서 '무작정 열심히'보단, '의식적인 연습'을 지속해 나가야 했다. 이득충이 되는 방향으로 공부를 하다 보니까, 내가 어떤 방식으로 공부를 하는 지 어느 정도 정리가 됐다. velog의 독자들은 '경험기'같은 글에 니즈가 꽤 있는 것 같아서, 부족하지만 내 공부를 위한 매개체들을...

velog.io

 

반응형
Posted by blueasa
, |