Posts

Post marked as solved
1 Replies
308 Views
I have an app running on WatchOS. How many BLE peripherals can my app connect to at the same time? If the number of peripheral objects is limited in some way, is the limit imposed on each instance of CBCentralManager? Or is the limit imposed on each app? I have a use case that would require four BLE peripheral connections. Is tis possible? I have another use case that would require 6 BLE peripheral connections. Is this possible?
Posted
by ehmjaysee.
Last updated
.
Post not yet marked as solved
15 Replies
14k Views
My Enviroinment:xcode 8.2.1Swift 3.0MacOS 10.12.3Maybe I misunderstand how iCloud Drive is designed to work. My iPhone app will create files and store them in the app's ubiquitous file folder so they should appear in the icloud drive on the mac or PC. However the files are not visible with the mac finder even though the files do exist in the mac filesystem. More on this later.Here is my code to create the file:let containerURL = FileManager.default.url(forUbiquityContainerIdentifier: nil) let documentDirectoryURL = containerURL!.appendingPathComponent("Documents") let documentURL = documentDirectoryURL.appendingPathComponent("myFile.txt") let text = String("test message") text.write(to: documentURL, atomically:true, encoding:String.Encoding.utf8)You can see I am using the app's default ubiquity container URL and appending the folder "Documents" and appending a filename. The app runs without any errors and I can confirm the file is created and viewable from the iCloud Drive app on the phone. In fact the iCloud Drive app on the iPhone will show me the correct folder name as I defined it with NSUbiquitousContainerName. I can also view this file on the Mac in a couple ways:1) Using the terminal program on the Mac I can see the file is created and updated correctly at this path: /Users/mjc/Library/Mobile Documents/iCloud~com~mchartier~motoproto1/Documents/myFile.txt2) Using the Mac Finder I can see the file when I click on "All My Files".However I do not see the file or the app's ubiquitous folder when I click on "iCloud Drive" on the Finder. Nor do I see anything on icloud.com or on my PC running iCloud software.Here is another weird behavior: Open the Finder and click on "all my files" and I see my file. Right click on the file and select "show in containing folder" and now I see my file appear with the full path to the file as you would expect. So far so good. Now when I click on "iCloud Drive" I see a new folder appear called "TextEdit" which was never there before. Now when I click on TextEdit I can see my file appear and I can open and view file contents. However, I still do not see anything on icloud.comI have iCloud enabled in my xcode project capabilities and I have my entitlements setup correctly as far as I can tell. I am using the default ubiquity container. I increased my build number each time I changed info.plist to make sure the settings will take affect. Here are relevant lines from info.plist :<key>NSUbiquitousContainers</key><dict><key>iCloud.com.mchartier.motoproto1</key><dict><key>NSUbiquitousContainerIsDocumentScopePublic</key><true/><key>NSUbiquitousContainerName</key><string>MotoProto1</string><key>NSUbiquitousContainerSupportedFolderLevels</key><string>None</string></dict></dict>So to summarize: My ubiquitous folder is not ubiquitous at all. The files created on the iPhone can only be viewed correctly by using the iCloud drive app on the phone itself. The files are clearly sent into the iCloud because they show up on the Mac filesystem but my app's ubiquity folder will not show up in the iCloud Drive folder in the Finder.
Posted
by ehmjaysee.
Last updated
.
Post not yet marked as solved
2 Replies
1.2k Views
How can I prevent iOS from evicting files from my app's ubiquitous folder?My app is designed to run on the iPhone when there is no network connectivity. The app stores files in the iCloud drive ubiquitous folder. When/If the phone connects to the network those files will get automatically synced up to iCloud. All of this works well. However sometimes iOS decides to evict files from the iPhone device. This is a problem because the user may need these files after they are evicted and there is no network connectivity.
Posted
by ehmjaysee.
Last updated
.
Post not yet marked as solved
0 Replies
441 Views
I have several cases in my apps where asynchronous behavior could lead to a situation where dismiss() is called a very short time after calling present(). Consider this code sample to illustrate: let alert = UIAlertController(title: "title", message: "message", preferredStyle: .alert) self.present(alert, animated: true, completion: nil) [ do some work here ] alert.dismiss(animated: true) The amount of time between the present() and dismiss() could be long or short, possibly less than a millisecond if there is no work to do. If the work is completed immediately will it result in a runtime error? If the call to dismiss() should be delayed until the presentation is complete, how would I code that?
Posted
by ehmjaysee.
Last updated
.