0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

iPhoneからMacOSにファイルをコピーする

Last updated at Posted at 2025-06-10

確認した環境

  • iMac Late 2015 + Sonoma 14.2.1
  • iPhone SE2 + iOS 17.6.1

手順

libimobiledeviceをインストールする

brew でインストール
セルフビルドは🦑などを参考

Xcodeのプロジェクトを作る

Create New Project
-> macOS
-> App -> 適当な場所に適当な名前で作成

Bridging-Header.h とか

#ifndef Bridging_Header_h
#define Bridging_Header_h

#include <libimobiledevice/libimobiledevice.h>
#include <libimobiledevice/lockdown.h>
#include <libimobiledevice/afc.h>

#endif /* Bridging_Header_h */

Build Settings -> All
-> Objective-C Bridging Header ([プロジェクト名]/Bridging-Header.hなどを入力)

Build Settings
-> Library Search Paths (/usr/local/lib)

Build Settings
-> Header Search Paths (/usr/local/include)

Build Settings
-> Other Linker Flags (-limobiledevice-1.0)

Build Settings
-> Architectures
-> $(ARCHS_STANDARD) -> x86_64

コードを書く

以下参照

ビルドして実行

スクリーンショット 2025-06-10 16.57.15.png

D&Dするとこんな感じでコピーできる

[ContentView.swift:256] copyFromIPhoneToMac(from:to:): copy //iTunes_Control/Music/F05 -> /Users/tyano
[ContentView.swift:249] copy_inner(using:from:to:): copy done //iTunes_Control/Music/F05/TTNW.m4a -> /Users/tyano/F05/TTNW.m4a
[ContentView.swift:249] copy_inner(using:from:to:): copy done //iTunes_Control/Music/F05/CEHQ.m4a -> /Users/tyano/F05/CEHQ.m4a
[ContentView.swift:249] copy_inner(using:from:to:): copy done //iTunes_Control/Music/F05/XRGK.mp3 -> /Users/tyano/F05/XRGK.mp3
[ContentView.swift:249] copy_inner(using:from:to:): copy done //iTunes_Control/Music/F05/SOQB.m4a -> /Users/tyano/F05/SOQB.m4a
[ContentView.swift:249] copy_inner(using:from:to:): copy done //iTunes_Control/Music/F05/ZQQI.m4a -> /Users/tyano/F05/ZQQI.m4a
tyano@macnoiMac ~ % ls -alrt ~/F05
total 93168
drwxr-x---+ 27 tyano  staff       864  6 10 16:57 ..
-rw-r--r--   1 tyano  staff   8460562  6 10 16:57 TTNW.m4a
-rw-r--r--   1 tyano  staff   8498602  6 10 16:57 CEHQ.m4a
-rw-r--r--   1 tyano  staff   9466819  6 10 16:57 XRGK.mp3
-rw-r--r--   1 tyano  staff   9588277  6 10 16:57 SOQB.m4a
drwxr-xr-x   7 tyano  staff       224  6 10 16:57 .
-rw-r--r--   1 tyano  staff  11679783  6 10 16:57 ZQQI.m4a

その他

D&Dの反応がめちゃくちゃ悪くて10回くらい掴まないと反応しないんだけど
なんでだろう

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?