Closed MWSStone closed 3 months ago
Not sure. Could it be the version of watchOS you are targeting?
Best look in the package file and see if everything is compatible.
Hello drewmccormack,Thank you for your swift reply. My watch is on OS 10.5 (21T576).I’m rather a noob at this so what should I look for in the package file.Cheers,MichaelSent from my iPhoneOn 24 Jul 2024, at 18:05, Drew McCormack @.***> wrote: Not sure. Could it be the version of watchOS you are targeting? Best look in the package file and see if everything is compatible.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>
To me, it sounds like you haven't added the module to your watch app target properly. Click on your target in Xcode. You should see Frameworks at the bottom of the General tab. Make sure you add SwiftCloudDrive there, and that it gets embedded in our watch app.
Good morning Drew, Every day is a learning day. That was the problem. Thank you so much. I consider this (non) issue closed. However, I have another problem with using the package: I have the following Task inside a Button action Task { let iCloudDrive = try? await CloudDrive()//(ubiquityContainerIdentifier: "iCloud.com.LRTrckr.app") let path = RootRelativePath(path: "Documents") let data = root.gpx().data(using: .utf8)! try? await iCloudDrive?.createDirectory(at: path) let dirExists = try? await iCloudDrive?.directoryExists(at: path) print(dirExists) if dirExists! { let fileExists = try? await iCloudDrive?.fileExists(at: path.appending("IamOverHere.gpx")) print(fileExists) if fileExists! { try? await iCloudDrive?.writeFile(with: data, at: path.appending("IamOverHere.gpx")) } else { try? await iCloudDrive?.writeFile(with: data, at: path.appending("IamOverHere.gpx")) } } } When it runs initially dirExists is true, fileExists is false. The next time both report true. So far so good. My problem is: Where on earth is that file? I have searched for it in the Finder and all I get is the ContentView file which of course contains the string “IamOverHere.gpx”. I have tried it on device as well as in the simulator but no file seems to be produced, certainly not in my iCloud Drive. I am obviously missing something. If you could help or point me in the direction of a working example I would be most grateful. Thank you for your time. Cheers, Michael
On 25 Jul 2024, at 09:20, Drew McCormack @.***> wrote:
To me, it sounds like you haven't added the module to your watch app target properly. Click on your target in Xcode. You should see Frameworks at the bottom of the General tab. Make sure you add SwiftCloudDrive there, and that it gets embedded in our watch app.
— Reply to this email directly, view it on GitHub https://github.com/drewmccormack/SwiftCloudDrive/issues/11#issuecomment-2249744139, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYQXK2GWNPDAHAMSEAHYQSTZOCYN7AVCNFSM6AAAAABLMYMN6GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBZG42DIMJTHE. You are receiving this because you authored the thread.
The file is in the ubiquity container. On Mac, for a Mac app, that is in ~/Library/Mobile Documents
.
On iOS, in a real app, if you are using Documents, it should be in the Files app in the Documents folder.
In the simulator, you would need to go looking for you app using SymPholders or something like that.
In any case, you should be able to set a breakpoint in the code and print out the path. Just use iCloudDrive.rootDirectory
to get the path to the root.
Hello Drew (yet again), I really appreciate your patience. Running the app in the simulator I get the file in the rootDirectory but when I test the app on device it does not show up in the Files app. It seems that iCloud Drive does not allow a folder called “Documents” in it. If you try to create one in the Finder it reverts to “Untitled Folder” so I made a folder called “LRTrckr" and changed the code in my Task accordingly. The only thing not happening is that the file does not get sent to the cloud. All my devices are signed in with the same AppleID. I must be still missing something, but what? Sorry to be a pain. Cheers, Michael
On 25 Jul 2024, at 10:48, Drew McCormack @.***> wrote:
The file is in the ubiquity container. On Mac, for a Mac app, that is in ~/Library/Mobile Documents.
On iOS, in a real app, if you are using Documents, it should be in the Files app in the Documents folder.
In the simulator, you would need to go looking for you app using SymPholders or something like that.
In any case, you should be able to set a breakpoint in the code and print out the path. Just use iCloudDrive.rootDirectory to get the path to the root.
— Reply to this email directly, view it on GitHub https://github.com/drewmccormack/SwiftCloudDrive/issues/11#issuecomment-2249925265, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYQXK2DUL5BZIQQCT4ZDCLLZODCXXAVCNFSM6AAAAABLMYMN6GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBZHEZDKMRWGU. You are receiving this because you authored the thread.
The files you add on an iOS device should appear on your Mac in ~/Library/Mobile Documents (which is the same as iCloud Drive) in the subfolder of your app. You should also be able to see the files in Finder if you open ~/Library/Mobile Documents
. If you don't see them, make sure you have the same bundle id. It might be that you need to run a production version of your app.
Note that Finder hides stuff when you access iCloud Drive. To see everything, you might want to use Terminal...
cd "~/Library/Mobile Documents"
ls
Every app has a standard Documents
subfolder created there automatically. No need to create it.
As I said, Finder does a lot of hiding of stuff. Whether you see the documents in Finder depends on your app setup. I don't use the Documents folder in my own app, but it is there in Terminal.
To find the right subfolder, you usually use your bundle id. Eg. My bundle id is ist.glisten.app.glisten
. This becomes the folder iCloud~ist~glisten~app~glisten
Accessing files on an iOS device is always painful. Apple don't make it easy. The simulator is generally best for this, because they are just on your Mac.
Oh dear:  I’m beginning to think the word simple has a different meaning in app development than in real life! Cheers and thanks anyway, Michael
On 25 Jul 2024, at 17:01, Drew McCormack @.***> wrote:
The files you add on an iOS device should appear on your Mac in ~/Library/Mobile Documents (which is the same as iCloud Driver) in the subfolder of your app. You should also be able to see the files in Finder if you open ~/Library/Mobile Documents. If you don't see them, make sure you have the same bundle id. It might be that you need to run a production version of your app.
Note that Finder hides stuff when you access iCloud Drive. To see everything, you might want to use Terminal...
cd "~/Library/Mobile Documents" ls Every app has a standard Documents subfolder created there automatically. No need to create it.
As I said, Finder does a lot of hiding of stuff. Whether you see the documents in Finder depends on your app setup. I don't use the Documents folder in my own app, but it is there in Terminal.
To find the right subfolder, you usually use your bundle id. Eg. My bundle id is ist.glisten.app.glisten. This becomes the folder iCloud~ist~glisten~app~glisten
Accessing files on an iOS device is always painful. Apple don't make it easy. The simulator is generally best for this, because they are just on your Mac.
— Reply to this email directly, view it on GitHub https://github.com/drewmccormack/SwiftCloudDrive/issues/11#issuecomment-2250802534, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYQXK2AV7X5ZGCMPGCG6HXTZOEONXAVCNFSM6AAAAABLMYMN6GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJQHAYDENJTGQ. You are receiving this because you authored the thread.
Good afternoon Drew (for the last time… honest), I went on a 50 mile bicycle ride today to clear my mind and realised that I am out of my depth on this so I have decided to rethink my app and start over. You have taught me a couple of things which I have already put to good use so it has not been a total waste of time (for me ,anyway). Once again, thank you very much for your patience and have a good summer. Cheers, Michael
On 25 Jul 2024, at 17:01, Drew McCormack @.***> wrote:
The files you add on an iOS device should appear on your Mac in ~/Library/Mobile Documents (which is the same as iCloud Driver) in the subfolder of your app. You should also be able to see the files in Finder if you open ~/Library/Mobile Documents. If you don't see them, make sure you have the same bundle id. It might be that you need to run a production version of your app.
Note that Finder hides stuff when you access iCloud Drive. To see everything, you might want to use Terminal...
cd "~/Library/Mobile Documents" ls Every app has a standard Documents subfolder created there automatically. No need to create it.
As I said, Finder does a lot of hiding of stuff. Whether you see the documents in Finder depends on your app setup. I don't use the Documents folder in my own app, but it is there in Terminal.
To find the right subfolder, you usually use your bundle id. Eg. My bundle id is ist.glisten.app.glisten. This becomes the folder iCloud~ist~glisten~app~glisten
Accessing files on an iOS device is always painful. Apple don't make it easy. The simulator is generally best for this, because they are just on your Mac.
— Reply to this email directly, view it on GitHub https://github.com/drewmccormack/SwiftCloudDrive/issues/11#issuecomment-2250802534, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYQXK2AV7X5ZGCMPGCG6HXTZOEONXAVCNFSM6AAAAABLMYMN6GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJQHAYDENJTGQ. You are receiving this because you authored the thread.
If you need to sync, but don’t need files, you might be better to look at apple’s CloudKit sync engine. That seems like a good way to move data between devices reasonably easily:
Hello Drew, Thought you might like to know that I solved my problem. I was barking up the wrong tree and realised that I needed to use ShareLink, something which I was unaware existed until a couple of days ago. It does exactly what I want in about 4 lines of extra code. Once again, thank you so much for your help. Cheers, Michael
On 26 Jul 2024, at 16:59, Drew McCormack @.***> wrote:
If you need to sync, but don’t need files, you might be better to look at apple’s CloudKit sync engine. That seems like a good way to move data between devices reasonably easily:
— Reply to this email directly, view it on GitHub https://github.com/drewmccormack/SwiftCloudDrive/issues/11#issuecomment-2253054288, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYQXK2AHES7HZXLBLV4JYN3ZOJW6VAVCNFSM6AAAAABLMYMN6GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENJTGA2TIMRYHA. You are receiving this because you authored the thread.
The title above says it all. In the Swift Package Manager website this package is marked as compatible with watchOS. I am using Xcode 15.4 so it should be using Swift 5.10. No problem with the companion iOS app. Any ideas.