タグ: apple

  • ストア公開 D-U-N-S ナンバーを取得しよう

    ストア公開 D-U-N-S ナンバーを取得しよう

    🐏 コラムです。

    法人の場合、Google Play Store や Apple Store にアプリリリースするにあたり、DUNS No.が必要になる場合があります。

    この記事ではその手順について解説します。

    DUNSとは?

    DUNS番号(D-U-N-S Number)は、企業や団体の信用情報を管理するためにDun & Bradstreet(D&B)が発行する識別番号です。

    https://www.dnb.com/en-us/smb/duns/get-a-duns.html#gad

    手順

    Appleのデベロッパーの場合、以下のページから無料で検索、申請ができます。
    ぶっちゃけ一番UIが良くて使いやすいのでAppleから取得すると良いなと個人的に感じました。
    https://developer.apple.com/support/D-U-N-S

    手順に従って住所や電話番号を入力するだけです!

    できた!

  • Flutter Webでの Firebase API Key の読み込み クロスプラットフォーム対応

    Flutter Webでの Firebase API Key の読み込み クロスプラットフォーム対応

    Flutter でWebで動作させる場合にAPI Keyを直書きしない方法について解説します。

    通常 index.html にそのまま書けば動作します。

    <body>
      <script src="flutter_bootstrap.js" async></script>
      <script>
        const apiKey = "{{API_KEY}}"; // Dartコードで置換
        const script = document.createElement('script');
        script.src = `https://maps.googleapis.com/maps/api/js?key=ここにAPI KEYベタ打ち`;
        document.head.appendChild(script);
      </script>
    </body>

    しかしこれだと、Gitなどでの管理ができなくなってしまうため、.env ファイルから読み出したいところです。しかしindex.html から直接.env を参照することはできません。

    解決方法

    プラットフォームごとの処理を追加

    Web の場合は以下のファイルを読み込むようにします。 lib の直下に utils ディレクトリを作成し、web_utils.dart を作成しました。

    このようにファイルを分けることで、
    import ‘dart:html’ as html;
    が使えるようになります。

    このパッケージはWebのみで動作するため、他のプラットフォームのコードに含められないからです。

    // ignore: avoid_web_libraries_in_flutter
    import 'dart:html' as html;
    
    void addGoogleMapsScript(String apiKey) {
      final script = html.ScriptElement()
        ..src = 'https://maps.googleapis.com/maps/api/js?key=$apiKey&callback=initMap'
        ..type = 'text/javascript'
        ..async = true
        ..defer = true;
      html.document.body!.append(script);
    }

    Web 以外(iOS, Android)の場合の処理を書いたファイルも用意します。utils ディレクトリに stub_utils.dart を作成。以下のように書きました。

    void addGoogleMapsScript(String apiKey) {
      // モバイルプラットフォームでは何もしない
    }

    main.dart での処理

    flutter_dotenv パッケージを追加します。

    flutter pub add flutter_dotenv
    import 'package:flutter/material.dart';
    import 'package:firebase_core/firebase_core.dart';
    import 'package:flutter_dotenv/flutter_dotenv.dart';
    import 'firebase_options.dart';
    import 'widgets/bottom_nav_layout.dart';
    import 'package:flutter/foundation.dart' show kIsWeb;
    
    // 条件付きインポート
    import 'utils/web_utils.dart'
      if (dart.library.html) 'utils/web_utils.dart'
      if (dart.library.io) 'utils/stub_utils.dart';
    
    void main() async {
      WidgetsFlutterBinding.ensureInitialized();
      
      // 環境変数を読み込む
      await dotenv.load(fileName: ".env");
    
      // Firebaseの初期化
      await Firebase.initializeApp(
        options: DefaultFirebaseOptions.currentPlatform,
      );
    
      // Webの場合のみGoogle Mapsスクリプトを追加
      if (kIsWeb) {
        final apiKey = dotenv.env['GOOGLE_MAPS_API_KEY'];
        if (apiKey != null && apiKey.isNotEmpty) {
          addGoogleMapsScript(apiKey);
        } else {
          print('Error: GOOGLE_MAPS_API_KEY is not set in the .env file.');
        }
      }
    
      runApp(const MyApp());
    }
    
    class MyApp extends StatelessWidget {
      const MyApp({super.key});
    
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Anonymous Login Demo',
          theme: ThemeData(
            useMaterial3: true,
            colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepOrange),
          ),
          home: const BottomNavLayout(currentIndex: 0),
        );
      }
    }

    firebase console で web を追加

    firebase console でモバイルだけでなく、webを追加して、apikey を発行しましょう。

    これを.envに追加します。

    .evn ファイルの設定

    以下のように設定します。
    api_key_here のところで先ほど設定したapi key を入力しましょう。

    GOOGLE_MAPS_API_KEY=your_google_maps_api_key_here
    
    # Firebase iOS Configuration
    FIREBASE_IOS_API_KEY=your_firebase_ios_api_key_here
    FIREBASE_IOS_APP_ID=your_firebase_ios_app_id_here
    FIREBASE_IOS_MESSAGING_SENDER_ID=your_firebase_ios_messaging_sender_id_here
    FIREBASE_IOS_PROJECT_ID=your_firebase_ios_project_id_here
    FIREBASE_IOS_STORAGE_BUCKET=your_firebase_ios_storage_bucket_here
    FIREBASE_IOS_BUNDLE_ID=your_firebase_ios_bundle_id_here
    
    # Firebase Web Configuration
    FIREBASE_WEB_API_KEY=your_firebase_web_api_key_here
    FIREBASE_WEB_AUTH_DOMAIN=your_firebase_web_auth_domain_here
    FIREBASE_WEB_PROJECT_ID=your_firebase_web_project_id_here
    FIREBASE_WEB_STORAGE_BUCKET=your_firebase_web_storage_bucket_here
    FIREBASE_WEB_MESSAGING_SENDER_ID=your_firebase_web_messaging_sender_id_here
    FIREBASE_WEB_APP_ID=your_firebase_web_app_id_here
    FIREBASE_WEB_MEASUREMENT_ID=your_firebase_web_measurement_id_here

    firebase の設定 firebase_options.dart

    プラットフォームごとに api key を切り分けるのに使います。

    import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
    import 'package:flutter/foundation.dart' show defaultTargetPlatform, kIsWeb, TargetPlatform;
    import 'package:flutter_dotenv/flutter_dotenv.dart';
    
    /// Default [FirebaseOptions] for use with your Firebase apps.
    class DefaultFirebaseOptions {
      static FirebaseOptions get currentPlatform {
        if (kIsWeb) {
          return web;
        }
        switch (defaultTargetPlatform) {
          case TargetPlatform.android:
            throw UnsupportedError('DefaultFirebaseOptions have not been configured for android.');
          case TargetPlatform.iOS:
            return ios;
          case TargetPlatform.macOS:
            throw UnsupportedError('DefaultFirebaseOptions have not been configured for macos.');
          case TargetPlatform.windows:
            throw UnsupportedError('DefaultFirebaseOptions have not been configured for windows.');
          case TargetPlatform.linux:
            throw UnsupportedError('DefaultFirebaseOptions have not been configured for linux.');
          default:
            throw UnsupportedError('DefaultFirebaseOptions are not supported for this platform.');
        }
      }
    
      static final FirebaseOptions ios = FirebaseOptions(
        apiKey: dotenv.env['FIREBASE_IOS_API_KEY']!,
        appId: dotenv.env['FIREBASE_IOS_APP_ID']!,
        messagingSenderId: dotenv.env['FIREBASE_IOS_MESSAGING_SENDER_ID']!,
        projectId: dotenv.env['FIREBASE_IOS_PROJECT_ID']!,
        storageBucket: dotenv.env['FIREBASE_IOS_STORAGE_BUCKET']!,
        iosBundleId: dotenv.env['FIREBASE_IOS_BUNDLE_ID']!,
      );
    
      static final FirebaseOptions web = FirebaseOptions(
        apiKey: dotenv.env['FIREBASE_WEB_API_KEY']!,
        authDomain: dotenv.env['FIREBASE_WEB_AUTH_DOMAIN']!,
        projectId: dotenv.env['FIREBASE_WEB_PROJECT_ID']!,
        storageBucket: dotenv.env['FIREBASE_WEB_STORAGE_BUCKET']!,
        messagingSenderId: dotenv.env['FIREBASE_WEB_MESSAGING_SENDER_ID']!,
        appId: dotenv.env['FIREBASE_WEB_APP_ID']!,
        measurementId: dotenv.env['FIREBASE_WEB_MEASUREMENT_ID'],
      );
    }

  • Flutter build iOS error ビルドできない

    Flutter build iOS error ビルドできない

    flutter build ios

    としたところ、以下のようなエラーが出てきた。

    ══════════ No valid code signing certificates were found You can connect to your Apple Developer account by signing in with your Apple ID in Xcode and create an iOS Development Certificate as well as a Provisioning Profile for your project by:   1- Open the Flutter project's Xcode target with        open ios/Runner.xcworkspace   2- Select the 'Runner' project in the navigator then the 'Runner'   target      in the project settings   3- Make sure a 'Development Team' is selected under Signing &   Capabilities > Team.      You may need to:          - Log in with your Apple ID in Xcode first          - Ensure you have a valid unique Bundle ID          - Register your device with your Apple Developer Account          - Let Xcode automatically provision a profile for your app   4- Build or run your project again   5- Trust your newly created Development Certificate on your iOS   device      via Settings > General > Device Management > [your new      certificate] > Trust  For more information, please visit:   https://developer.apple.com/library/content/documentation/IDEs/Conce   ptual/   AppDistributionGuide/MaintainingCertificates/MaintainingCertificates   .html  Or run on an iOS simulator without code signing ══════════════════════════════════════════════════════════════════════ ══════════ No development certificates available to code sign app for device deployment
    ══════════
    No valid code signing certificates were found
    You can connect to your Apple Developer account by signing in with
    your Apple ID
    in Xcode and create an iOS Development Certificate as well as a
    Provisioning
    Profile for your project by:
      1- Open the Flutter project's Xcode target with
           open ios/Runner.xcworkspace
      2- Select the 'Runner' project in the navigator then the 'Runner'
      target
         in the project settings
      3- Make sure a 'Development Team' is selected under Signing &
      Capabilities > Team.
         You may need to:
             - Log in with your Apple ID in Xcode first
             - Ensure you have a valid unique Bundle ID
             - Register your device with your Apple Developer Account
             - Let Xcode automatically provision a profile for your app
      4- Build or run your project again
      5- Trust your newly created Development Certificate on your iOS
      device
         via Settings > General > Device Management > [your new
         certificate] > Trust
    
    For more information, please visit:
      https://developer.apple.com/library/content/documentation/IDEs/Conce
      ptual/
      AppDistributionGuide/MaintainingCertificates/MaintainingCertificates
      .html
    
    Or run on an iOS simulator without code signing
    ══════════════════════════════════════════════════════════════════════
    ══════════
    No development certificates available to code sign app for device
    deployment
    

    解決法

    terminal で ios/Runner.xcworkspace ファイルを開く

    open ios/Runner.xcworkspace
    XCode
    こんな感じで xcode が立ち上がる。

    Xcodeで「Runner」プロジェクトを選択

    「Signing & Capabilities」タブを開く

    私の場合、久しぶりのストアアップロードで規約に同意していないのが原因でした。

    Unable to process request – PLA Update available
    You currently don’t have access to this membership resource. To resolve this issue, agree to the latest Program License Agreement in your developer account.

    StoreConnectから同意したらできました。

    “Automatically manage signing”(自動管理) をチェック

    「Team」のプルダウンから Apple Developer アカウントを選択

    「Provisioning Profile」が作成されるのを確認

    以上です。

    再度以下のコマンドでビルドしなおしましょう。

    flutter build iOS

  • iMac の復旧ができなくなった “mac インストールの準備中にエラーが起きました”

    iMac の復旧ができなくなった “mac インストールの準備中にエラーが起きました”

    先日 AppliSilicon M1 iMac を譲り受けました。
    その際初期化したところ、OSのインストール時にエラーが起きてしまい、起動できなくなってしました。

    今回はそれの解決方法の記事です。

    環境

    壊れた方の iMac

    • Apple Silicon M1
    • Ventura
    • 16GB

    回復に使用した MacBook Air

    • Apple Silicon M1
    • Sequoia 15.0.1
    • 16GB

    問題の起きた場面と、エラー画面

    [macOS Ventura を再インストール]のボタンを押して、インストール画面に進むと以下のようなエラー画面が出てしまっていました。

    mac インストールの準備中にエラーが起きました

    このポップアップが出て、OSのインストールが完了しませんでした。何度やっても同じなのと、ディスクユーティリティで First Aid や削除も試しましたが、永遠に同じエラーが出続けました。

    画像撮ってなかったので、知恵袋で同じような悩みの方の画像引用させていただきます。
    https://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q14292903294

    Apple のサポートページにも同じ症状の方がいました。

    https://discussionsjapan.apple.com/thread/255485243?sortBy=rank

    ちなみにエラーログは下記の通りです。ログからエラーの解決には繋がらなかったので画像のみで失礼します。

    error log

    解決した方法 DFU

    DFU(Device Firmware Update)とは、Appleデバイスのファームウェアをアップデートしたり修復したりするためのモードです。

    この方法は正常に動作している mac OS が手元にある場合にできる方法です。

    0. 壊れていない Mac を用意して Apple Configurator をインストールする

    私の場合 Apple Silicon M1 MacBook Air を使いました。

    この MacBook に Apple Configurator というアプリをインストールしておきます。

    https://apps.apple.com/jp/app/apple-configurator/id1037126344?mt=12

    1. ディスクユーティリティの操作

    iMac の復旧画面からディスクユーティリティを選択します。
    次にMachintosh HD の項目があるので、これを削除します。

    2. iMac(壊れている方) と MacBook(壊れていない) をつなぐ

    iMac と MacBook をケーブルで接続します。
    私は MacBook に付属していた C to C の充電ケーブルで動作を確認しました。

    3. iMac の電源コードを抜く

    iMac をシャットダウンして、電源コードを抜きます。

    4. DFUモードに入る

    電源ボタンを押しながら、電源ケーブルを指します。

    電源長押しではありません。私はずっと長押しでやるものだと勘違いしてました😭

    DFUモードに入ると iMac 側の画面は真っ暗なままですが、 MacBook Air (正常に動作している方)に [アクセサリの接続の許可]のダイアログが出てくるはずです!

    MacBook Air の Apple Configurator アプリ上では、以下のように DFU のアイコンが表示されるはずです。

    5. configurator から復旧する

    DFUアイコンの上から右クリックをします。
    そこから[復元する]という項目をクリックします。

    確認のポップアップが表示されるので、あとは[OK]を選択していけば大丈夫です!

    6. iMac でOS再インストールする

    この後 iMac が復旧するはずです!?
    私の環境では以下のように表示されました。

    mac os recovery

    画面の表示に従って再起動をすると

    セコイアインストールできた!

    [Reinstall macOS Sequoia]の文字が!!!

    これをする前までは[Reinstall macOS Ventura ]だったため、外部のmacから操作できたことが確認できました!

    参考

    Apple Configure2 ついて

    https://support.apple.com/ja-jp/guide/apple-configurator-2/apdd5f3c75ad/mac

    復旧についてのApple公式ページ

    https://support.apple.com/ja-jp/108900

  • Unity Git 管理 with Git LFS

    Unity Git 管理 with Git LFS

    この記事は?

    Unity のプロジェクトをGitで管理する方法です。SourceTree などを使った方法は直ぐに検索に出てきますが、すでにGitを使ったことがある方に向けた記事です。

    使用環境

    • Apple Silicon M1 MacBook Air
    • 16 Gb
    • macOS Sequoia 15.0
    • Unity 2022.3.31f1

    やり方

    Unityの設定
    .gitignore の作成
    Git LFS

    の3つの設定を順に紹介していきます。

    Unity 側の設定

    Unity のメニューの Edit/ Project Settings を開きます。

    左側のメニューからEditorを選択。

    Asset Serialization という項目があるので Force Text にします。(おそらく標準でなってる?)

    Unity Settings

    シーンやPrefabをテキスト形式で保存する設定のようです。
    Gitでの競合の解決を簡単にするために、バイナリ形式でなくテキスト形式にしました。

    Gitの設定

    Gitで管理したいファイルは下記の通りです。

    • Assets
    • Packages
    • ProjectSettings
    • UserSettings

    必要のないものはignoreに設定します。

    ルートディレクトリに .gitignore ファイルを以下の内容で作成しました。

    # Unity関連の生成ファイルを無視
    [Ll]ibrary/
    [Tt]emp/
    [Oo]bj/
    [Bb]uild/
    [Bb]uilds/
    [Ll]ogs/
    
    # 特定のプラットフォーム関連ファイル
    [Dd]ebugPublic/
    [Mm]emoryCaptures/
    [Uu]ser[Ss]ettings/
    
    # Visual StudioやJetBrains Rider関連
    .vscode/
    *.csproj
    *.unityproj
    *.sln
    *.suo
    *.user
    *.userprefs
    *.pidb
    *.booproj
    *.svd
    
    # その他
    *.swp
    *.lock
    *.idea/
    

    GitLFSの設定

    標準のGit を使っていて、サイズの大きなもののアップロードで警告が出たことはありませんか?

    ゲーム制作では3Dモデルや画像データなどが膨大になってしまうので、これでは厳しいです。

    そこでGit LFS を使用します。

    Git LFS(Git Large File Storage)は、大きなファイルやバイナリファイルを効率的に管理するためのツールです。

    Homebrew で Git LFS をインストール

    インストールしたことがない方はBrew からインストールします。

    https://formulae.brew.sh/formula/git-lfs

    brew install git-lfs

    インストールしたことある方はversion を確認します。

    git lfs --version

    Git の初期設定

    プロジェクトのディレクトリへ移動します。

    cd /あなたのプロジェクトディレクトリ

    Git を初期化します。

    git init

    LFSの有効化をします。

    git lfs install
    Updated Git hooks.
    Git LFS initialized.

    上手くLFSが有効化されると返答されます。

    管理したいファイルタイプを指定します。
    画像と3Dデータが重いので私は下記のように指定しました。

    git lfs track "*.png"
    git lfs track "*.fbx"

    あとは普段通りGit 操作します。

    git add .
    git commit -m "initial commit"

    補足 Git LFS が有効化されているか確認する

    git lfs ls-files

    上手くできていればした画像のように表示されるはずです。

    git LFS

  • 【小ネタ】macOS でアイコン画像が入っているディレクトリ

    【小ネタ】macOS でアイコン画像が入っているディレクトリ

    macOS がシステムで使用するアイコンが格納されているフォルダは


    /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources

    にあります。

    この中身が可愛いのでちょっとした紹介です。

    中身はざっくり見るとこんな感じなのですが…。

    中にはもう販売されていない懐かしの Apple 製品たちを見ることができます。

    Apple Xserve 2002年から11年まで産業用に発売されていたラックマウントサーバのアイコンもある……。

    可愛いモノクロアイコンたち

    黒い MacBook https://pc.watch.impress.co.jp/docs/2006/0523/apple.htm PC Watch でその存在を知ったけど本物を見たことがない。

    OS アップデートなどで消えていくアイコンもあるので、たまに見返すと楽しいですね。

  • SwiftUI macOS 新しいウィンドウで開く機能を追加する

    SwiftUI macOS 新しいウィンドウで開く機能を追加する

    これは何?

    macOS 向けの App の開発で SwiftUI を使って、新しいタブを開くやり方の紹介です。

    実装例

    環境

    • Apple Silicon M1 MacBook Air
    • 16 Gb
    • macOS Sequoia 15.0
    • Xcode Version 16.0 (16A242d)

    やり方

    今回は ContentView.swift に設置したボタンを押すと、 PopupWindow.swift が開くものを作ります。

    ウィンドウを用意

    まずは開きたいウィンドウを用意します。
    今回は PopupWindow.swift みたいな適当なファイル名とします。

    //
    //  PopupWindow.swift
    //  sample
    //
    //
    
    import SwiftUI
    import AVKit
    
    struct PopupWindow: View {
        
    
        var body: some View {
            VStack {
               Text("ポップアップウィンドウです")
            }
            .padding()
            .frame(minWidth: 440, minHeight: 480)
        }
    }
    
    #Preview {
        PopupWindow()
    }
    

    windwogroup を追加する

    プロジェクトを作成した際に自動的に作られる、
    アプリ名App.swift ファイルを開きます。

    ここに以下のように追記します。

    //
    //  アプリ名App.swift
    //  sample
    //
    //
    
    import SwiftUI
    
    @main
    struct FolderCustomizerApp: App {
    
        var body: some Scene {
            WindowGroup {
                ContentView()
            }
            // ここを追記した
            WindowGroup(id: "popup") {
                PopupWindow()
            }
        }
    }
    

    ボタンの設置

    最後に ContentView.Swift にボタンを追加ます。

    省略
    
    Button(action: {
        openWindow(id: "popup")
        }) {
        Label("help", systemImage: "keyboard.macwindow")
    }
    
    省略

    以上です! これで動作するはずです。

    もしサイドバーに複数ある情報をクリックして展開するといったことを目指されている場合は公式の
    https://developer.apple.com/jp/videos/play/wwdc2022/10061/ こちらのページがわかりやすくコードつきで解説されているので、こちらをご覧ください。

  • 【コラム】Predictive Code Completion Model が追加された! Xcode Version 16.0

    【コラム】Predictive Code Completion Model が追加された! Xcode Version 16.0

    注意カスみたいな記事です

    ベータ版から入れている方には今更かもしれませんが、
    Xcode に Predictive Code Completion Model が追加されました!

    Predictive Code Completion Model は Xcode 16 に対応した予測コード補完機能です。VSCode の Copilot と似ており、コード入力時に提案してくれます。

    個人的に Copilot for Xcode を使用していたので Apple さんが純正で搭載してくれたのは嬉しく思います☺️

    動作条件

    • macOS Sequoia
    • 16GB RAM
    • Apple Silicon

    となっているようです。

    使用感

    実際に使ってみました。

    まずはコメントアウトで、どうしたいのかを記述して改行すると…。

    2,3秒後にこんな感じでうっすらした文字で候補を出してくれます。

    tab キーを押すと候補が確定されます。ここら辺の操作感も VScode Copilot と似ています。
    肝心な制度は微妙に感じました…。ちゃんと使いたいなら Copilot for Xcode といった外部プラグインを使うのが良いなと思いました。(2024/09/19現在の所感)

    今後に期待☺️

  • Vision OS 音量をコントロールする

    Vision OS 音量をコントロールする

    ❓ これは何

    VisionOS での音(AudioPlaybackController)を Slider を使って音量をコントロールする方法についてです。

    🪴 環境

    • sonoma 14.5(23F79)
    • Apple M1
    • 16GB

    🛠️ やり方

    今回は自然の音を再生するアプリを例に作っていきます。

    NatureEntity.swift

    import SwiftUI
    import RealityKit
    
    class NatureEntity: Entity {
        private var fireAudioController: AudioPlaybackController?
        
        @MainActor required init() {
            super.init()
        }
        
        init(fireAudio: AudioPlaybackController?, rainAudio: AudioPlaybackController?, insectAudio: AudioPlaybackController?) {
            super.init()
            self.fireAudioController = fireAudio
        }
        
        func updateGlobalVolume(_ volume: Double) {
            fireAudioController?.gain = volume
        }
    }
    

    続いて、Sliderでの操作部分の作成です。

    NatureControls.swift

    import SwiftUI
    
    struct NatureControls: View {
        @Binding var globalVolume: Float
        
        var body: some View {
            VStack {
                Text("Global Volume")
                Slider(value: $globalVolume, in: 0...1)
                    .padding()
            }
        }
    }

    最後に、これらをまとめて表示する部分です。

    SoundView.swift

    import SwiftUI
    import RealityKit
    
    struct SoundView: View {
        @State private var globalVolume: Double = -10
        @State private var natureEntity: NatureEntity?
    
        var body: some View {
            ZStack {
                RealityView { content in
                    let natureEntity = NatureEntity(fireAudio: nil) // 実際のオーディオコントローラーを渡す
                    content.add(natureEntity)
                    self.natureEntity = natureEntity
                }
                
                NatureControls(globalVolume: $globalVolume)
                    .onChange(of: globalVolume) { volume in
                        natureEntity?.updateGlobalVolume(volume)
                    }
                    .padding()
                    .background(Color.black.opacity(0.7))
                    .cornerRadius(10)
                    .padding()
            }
        }
    }

    これで、音量調整のできる機能が備わったと思います。

    ポイントは fireAudioController?.gain = volume という部分で、
    音量調整は gain で行うということです。Doubleで渡してあげたところうまくいきました。

  • 【mac os】画像の解像度変える最も簡単な方法

    【mac os】画像の解像度変える最も簡単な方法

    ❓ これは何

    mac os で画像の解像度を純正アプリのみで変更する方法です。

    🛠️ やり方

    Finderで画像を右クリックします。
    このアプリケーションで開く からプレビュー.app を選択します。

    画像が開いたら、右上の「プレビューで開く」ボタンを押します。

    開いたら、ツール/サイズを調整を選択します。

    できたら幅と高さの値を好きに変更してあげましょう。
    縦横比の固定を外すと好きにいじれます。

    このまま保存してもOKなのですが、
    元の写真を残したい場合は、
    ファイル/複製 を選択して保存すると編集したものもどちらも残ります。

    以上です!
    記事をご覧いただきありがとうございました。

  • 【iOS, mac, vision os】Apple Store に申請する

    【iOS, mac, vision os】Apple Store に申請する

    ❓ これは何

    iOS, mac os, VisionOS などをストア申請するまでの手順の解説記事です。

    この記事は2024年7月現在の内容です。

    📗 手順

    🛠️ Xcode での操作

    xcode を開いて、Product から Archive を選択します。

    ポップアップが出てくるので、App Store Connect を選択します。

    あとは基本的にOKを押して進めていけば大丈夫です。

    💻 App Store Connect での操作

    https://appstoreconnect.apple.com/apps にアクセスすると、先ほどディストリビュートしたAppがあるはずです。

    スクリーンショットを追加しましょう。
    VisionOSの場合は3840*2160px である必要があります。
    事前に整えておきましょう。

    解像度の変更方法はこちらをご覧ください。

    • プロモーション用テキスト
    • 概要
    • キーワード
    • サポートURL

    を入力します。

    ビルドを追加しましょう。先ほどディストリビュートしたので選択できるはずです。
    コンプライアンスの部分も設定してください。クリックして次へを選択していけば基本的に大丈夫です。(フランスへの配信は別途捜査が必要)

    ログインが必要なAppの場合は App Reviewに関する情報からサインイン情報を追加します。
    不要な場合はチェックを外してください。

    できたらページ右上のボタンから保存を押しましょう。

    一般

    一般タグに切り替えて、名前とサブタイトルを追加します。

    一般情報の欄の「コンテンツ配信権」「年齢制限」「カテゴリ」をそれぞれ選択してください。

    できたらページ右上のボタンから保存を押しましょう。

    アプリのプライバシー

    「アプリのプライバシー」タブに移動します。
    「プライバシーポリシーURL」「プロダクトページのプレビュー」をそれぞれ設定してください。
    プライバシーポリシーのページがない場合はhttps://studio.design/などでサクッと制作すると良いでしょう。

    できたらページ右上の「公開」ボタンを押しましょう。

    価格および配信状況

    価格を選択してください。
    有料アプリの場合は別途設定が必要になるはずです。(規約に同意の必要がある)

    「アプリの配信状況」から配信する国を設定してください。

    アプリの提出

    全てできたら、「配信用に追加」ボタンを押して、「App Review」に提出しましょう。

    終わりに

    以上です。お疲れ様でした。

    記事をご覧いただきありがとうございます!!!

  • 【Unity】Cesiumが追加されていない Apple Silicon M1

    【Unity】Cesiumが追加されていない Apple Silicon M1

    ❓ これは何?

    Unity で Geospatial Creator をオンにしようとすると下記のエラーが出てしまいました。この記事は、解決方法です。

    The Geospatial Creator helps you build AR apps by showing where your content will be placed in the real world. 
    
    The project is missing the following required dependencies:  
    
    com.cesium.unity 1.1.0+ 
    
    See the Quickstart Guide for more information.

    💻 環境

    • チップ Apple M1
    • メモリ 16 GB
    • macOS sonoma 14.5(23F79)
    • Unity Version 2022.3.31f1

    💡 解決までの手順

    これはAppleSiliconのビルドではSesiumが含まれないのが通常になっているようです。

    1 Edit/ Project Settings からプロジェクト設定を開く

    開いたら、package manager のタブをクリックします。

    2 スコープレジストリを追加する。

    Name Cesium
    URL https://unity.pkg.cesium.com
    Scope(s) com.sesium.unity

    3 Window/ Package Manager を開く。

    My Resistries を選択すると Cesium for Unity が出てくるので install を押します。

    これで v1.6.2 以降であれば動作するはずです。

    4 ARCore Extensions Geospatial Creator をON

    Project Settings から ARCore Extensions のタブを開いて、Geospatial Creator をオン!

    できました〜 良かった


    📕 参考

    Cesium Community

    https://community.cesium.com/t/missing-dlls-in-osx-standalone-il2cpp-builds/26714

  • Uniy Cocoapods のinstall erro 【Apple silicon M1 Mac】

    Uniy Cocoapods のinstall erro 【Apple silicon M1 Mac】

    ❓ これは何?

    Unity でiOS向けにビルドする際に以下のエラーメッセージが出てきてしまいます。
    これを解決するまでの記事です。

    Error building Player: iOS framework addition failed due to a CocoaPods installation failure. This will will likely result in an non-functional Xcode project.

    💻 環境

    • チップ Apple M1
    • メモリ 16 GB
    • macOS sonoma 14.5(23F79)
    • Unity Version 2022.3.31f1

    💡 解決までの手順

    どうしてもうまくいかないので、ビルドしたフォルダで

    pod install

    しましたが、下記のようなエラーが

    cannot load such file — ffi_c (LoadError)

    しかし、

    gem list

    で確認すると、確かに ffi の項目はありました…。
    ので、下記のコマンドでアンインストールして、再インストール。

    sudo gem uninstall ffi && sudo gem install ffi -- --enable-libffi-alloc

    これでいけた!! うれし〜😭


    💪 試したこと

    以下は試したこと一覧です。どれも決定的な解決には至りませんでした。(もしかしたら何かがうまく作用してるかも…??)

    Rubyのアップデート

    最新のRubyのインストール

     brew install ruby

    環境変数の設定

    echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.zshrc source ~/.zshrc

    LibYAML のインストール

    C言語でYAMLファイルを簡単に扱うためのライブラリです。

    brew install libyaml

    psychはYAMLデータを解析または生成するためのRubyのライブラリです。

    sudo gem install psych

    cocoapod のインストール

    海外の方でYoutubeでこの方法でいけてる方がいました。(私はできなかった…。)

    sudo arch -x86_64 gem install ffi
    arch -x86_64 pod install

    CocoaPodsの再インストール

    CocoaPodsのアンインストール

    sudo gem uninstall cocoapods

    CocoaPodsのインストール

    sudo gem install cocoapods

    依存関係をクリーン

    pod cache clean --all

    CocoaPodsのキャッシュクリア

    キャッシュのクリア

    rm -rf ~/Library/Caches/CocoaPods
    rm -rf Pods
    rm -rf ~/Library/Developer/Xcode/DerivedData/*
    pod deintegrate
    pod setup

    📕 参考

    cocoapods itallation
    https://cocoapods.org

    chruby
    https://formulae.brew.sh/formula/chruby

Home
About
Blog
Works
Contact