Post

Replies

Boosts

Views

Activity

copyfile why does it take so much longer for a Sandboxed app to finish?
So, when copying a file or directory (particularly to an external drive) i've noticed there is a huge difference in performance between a sandboxed and non-sandboxed app.When copying a directory and the app isn't sandboxed, the copy finishes in reasonably fast (like a minute..didn't time it though). When sandboxed, copying is still going on...very slowly, it's been like 20 minutes. Still isn't finished. For what it's worth, when using NSFileManager API to copy I notice big performance hit too when the app is sandboxed (not sure if NSFileManager is just wrapping copyfile anyway). Anyone know why and if there is a workaround?
5
0
803
Apr ’20
Why does the COPYFILE_EXCL flag not work with copyfile for directories?
Using the COPYFILE_EXCL flag with the copyfile function works as expected when copying files (the copy fails if a file at the destination path already exists).But when copying a directory, if you specify this flag and the destination already exists copyfile will just copy the directory inside of the already existing directory, instead of failing with an error. Does anyone know why? It seems kind of peculiar to copy a directory to a location not specified by the caller?As far as I can tell the only way to get the behavior to work the way I'd expect is to look before you leap? So I'd have to do:if (destinationURLIsDirectory && [destinationURL checkResourceIsReachableAndReturnError:nil]) { NSLog(@"fail...destination already exists..don't start copyfile"); return; }
3
0
643
Apr ’20
NSURLVolumeIsInternalKey vs NSURLVolumeIsLocalKey
Can someone explain the distinction between these two attributes: NSURLVolumeIsLocalKey and NSURLVolumeIsInternalKey?The documentation for NSURLVolumeIsLocalKey:Key for determining whether the volume is stored on a local device, returned as a Boolean NSNumber object (read-only).And the documentation for NSURLVolumeIsInternalKey:Key for determining whether the volume is connected to an internal bus, returned as a Boolean NSNumber object, or nil if it cannot be determined (read-only).So, when I look at the values of these attributes for a volume mount on the local network both are NO as expected.When I connect a usb stick to my Macbook pro via a dongle (since i only have USB-c ports) I get YES for local, but NO for internal when I was actually expecting the values to be the other way around. Can someone clarify the distinction between these two attributes?Thanks
1
0
463
Mar ’20
MultipeerConnectivity Determining declined peer MCSession invitation vs error handling?
So I noticed when sending data using MultipeerConnectivity I'm not sure exactly how I'm supposed to distinguish between an error or a declined invitation. For example I have Device Sender & Device Receiver.1) Device Sender sends device Receiveran invitation using MCNearbyServiceBrowser's method -invitePeer:toSession:withContext:timeout:2) Device Sender hasthe delegate set on the session used to send the invitation.3) The delegate for the MCSession invitation waits for -session:peer:didChangeState: before sending the real meat.-(void)session:(MCSession*)session peer:(MCPeerID*)peerID didChangeState:(MCSessionState)state { if (state == MCSessionStateConnecting) { } else if (state == MCSessionStateNotConnected) { if (self.waitingOnReceiverToAcceptInvite) { NSLog(@"uh o, never got started abort...invitation was declined?"); [session disconnect]; } else { //Not connected. Maybe we finished all our work already, maybe not... //handle error in the completion handler of -sendResourceAtURL:withName:toPeer:withCompletionHandler: //if we have one } } else if (state == MCSessionStateConnected) { if (self.waitingOnReceiverToAcceptInvite) { self.waitingOnReceiverToAcceptInvite = NO; [self beingSendingStuffToReciever]; } } }So... the -beingSendingStuffToReciever method sends a resource using the session's sendResourceAtURL:withName:toPeer:withCompletionHandler:So during testing, if the Receiver declines the invitation the Sender's session gets -session:peer:didChangeState: with a not connected state. If the waitingOnReceiverToAcceptInvite property is YES, I bail on the session and assume the invitation was declined. Why? Because I don't see any other way to detect if the Sender declined the invitation. But, during testing, I noticed that other reasons (like errors which seem to be abstracted away and inaccessible from the MultipeerConnectivity API) can cause the session delegate to get a -session:peer:didChangeState: message with a MCSessionStateNotConnected state while my waitingOnReceiverToAcceptInvite is YES.So the peer is not connected to the session and I don't see a way to determine why. Was there some sort of network error and can I retry or did the Receiver just decline the invitation? How am I supposed to know? Is there some other API in this framework that I'm missing?Thanks a lot
5
0
1.8k
Feb ’20
Xcode 11 What Happened To Previewing Localization in Interface Builder?
In previous versions of Xcode you could preview UI in Interface Builder in another localization by doing this:1) Open the xib.2) Open the Assistant Editor and select Preview. Then in the bottom right corner it showed a language, which you could change.In Xcode 11 is there a new way to do this? Or do I have to change my default language in System preferences and run the app?
1
0
1.1k
Feb ’20
macOS Is There a Way to Programmatically Detect if 3 Finger Trackpad Dragging is Enabled (sandbox environment)?
Was wondering if there is a way to sniff the users trackpad settings for 3 finger dragging. The reason why I want to do this because I noticed a situation where NSScrollview sometimes scrolls during 3 finger dragging and swallows the 3 finger drag event.To workaround this, I could subclass NSScrollview and block scrolling during 3 finger drag. But when 3 finger dragging preference is not set, there's really no point in blocking scrolling because scrolling with 3 fingers on the trackpad ought to be permitted when the user isn't using that gesture for dragging. But as far as I can tell, there's no way to tell if the user has the preference on or off.
1
0
483
Feb ’20
App Won't Compile with Embedded Third Party Framework: Could not install at this time. Failed to load Info.plist from bundle at path
So, I'm getting this error when trying to run the app. "Build succeeds" but the app won't run and Xcode spits out an error:Could not install at this time.Failed to load Info.plist from bundle at pathAnd the path points to a 3rd party framework I use, pointing to its Info.plist: Extra info about plist: ACL=<not found>.If I choose "Do Not Embed" in the "Frameworks, Libraries, and Embedded Content" section of Xcode, the app build & runs. But if I choose "Link and Embed" the app, I get this error and the app won't run.Obviously, if I'm shipping the app to the App Store I need to embed the 3rd party framework in the application...Upon further inspection, if I look inside the .framework of the third party library it does not include an Info.plist file. Never had an issue related to this third party framework before. It's the GoogleMobileAds.framework...
10
0
17k
Dec ’19
CloudKit Notification for Checking if User Upgraded iCloud Storage Space for error handling?
So working on an app that uses CloudKit (private database). Now, the app is allowed to run in "local mode" if the user is not using iCloud or has disabled iCloud for my app.Now imaging this case:1) iCloud is not enabled for my app and the user starts creating data.2) The user subsequently enables iCloud for my app.3) My app gets a CKAccountChangedNotification.4) My app starts uploading local data the user created before iCloud was enabled to CloudKit.5) My app gets a CKErrorQuotaExceeded when uploading data.6) My app displays an alert, telling the user he has run out of iCloud storage and he can either Buy More in iCloud Settings or turn off iCloud for the app to run in "Local mode."So now my app is in this state where iCloud is enabled but the user has no iCloud storage left. I don't see any API to tell if iCloud storage changed. If the user goes to Settings, buys more storage, and goes back to my app, I'd like to retry sending the local data back to Cloudkit for initial sync. I guess I just have to retry the operation every time the app is launched and show the error over and over again until the user does something about it (disable iCloud in Settings or buy more storage)?Ideally, I'd like to give the user an option to turn off iCloud (for my app only) in app when the error is hit, because telling them to navigate to Settings to turn off iCloud is hard for a lot of people. Or present a system provided view controller offerring them to upgrade their iCloud storage plan. CKStoragePurchaserViewController?#pragma mark - CKStoragePurchaserViewControllerDelegate -(void)storagePurchaserViewControllerDidPurchaseAdditionalStorage:(CKStoragePurchaserViewController*)vc { //retry sync. } -(void)storagePurchaserViewControllerDidDisableICloudFunctionality:(CKStoragePurchaserViewController*)vc { //iCloud is now off, run the app in local mode. }
10
0
2.4k
Nov ’19
Recommended way for testing CloudKit with two separate Apple Developer accounts?
My developer account uses a different AppleId from the AppleID I use on my devices. Therefore, when I test on my device, I can't look at any of the data in the CloudKit dashboard. It would be a real pain in the neck to have to sign out of icloud and use my developer apple id on my devices just to test. Is there no way to use a different AppleID for CloudKit in the "sandbox" environment like we can for IAP?
13
0
4.0k
Oct ’19
UITableview content overlaps translucent nav bar when scrolled on iOS 13
So, a UItableview inside a *regular* UIViewController (not using UITableviewcontroller).1) This view controller is embedded in a UINavigationController. The navigation item has "automatic' large title mode.2) The navigation controller's nav bar prefers large title.3) When the table view is scrolled, the big title does *not* shrink to the *regular* title size like in the iOS mail app. Instead, the table view content overlaps the navbar and bleeds through, making a UI glitch.On iOS 12 the scrolled content does not overlap the nav bar. This is new in IOS 13. Anyone get this and have a workaround?
7
0
5.1k
Sep ’19
UITableViewHeaderFooterView Not Being Cleaned Up, Abandoned Duplicate Header (not sticky) sometimes appears in the table view
I'm having a hard time tracking the cause of this/ coming up with a workaround for this potential bug in UITableView. I have a UITableView, using the default section header view (I implement -tableView:titleForHeaderInSection: and return a string).After deleting some rows using -deleteRowsAtIndexPaths:withRowAnimation: I notice sometimes an extra header view will appear inside my UITableVIew. It has the same title as the sticky header above it, but it appears the table view lost its reference to the header view but didn't clean it up from the view hierarchy (it scrolls with the table view, never sticks to the top anymore). If I manually empty the entire data source and call reload data on the table view, the abandoned header view is still visible. Has anyone run into this before and know of possible cause and/or workaround?
7
0
4.2k
May ’19