What is the word in programming that means that checks a condition for true or false, and if the condition is false, code is run to make that condition true, so that if the condition is checked again, it would be true?
I believe I have seen something in Swift or Foundations that does this as applied to different things.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Created
Is there any way to run code in iOS whenever new information are added to certain contacts in contact store?
If I use Notifications, I would have to have a process running at all times, since contacts are able to be changed by Apple's Contacts app. I have looked at App Extensions and there are no extensions I that can be used.
There is a way to run a background process but I recall that has a limited lifespan. Am I correct about this?
I need to update data in CloudKit that saves contacts information that can be shared with other users using their own Apple ID's. CloudKit subscriptions notify my app when something changes in CloudKit, but I also need to update records in CloudKit when something changes in Contacts.
Anyone have any ideas how this might possibly be done?
I have this error:
[AXRuntimeCommon] AX Lookup problem - errorCode:1100 error:Permission denied portName:'com.apple.iphone.axserver' PID:963
It is preceded by lots of this message, if it matters:
[Assert] +[UIInputViewSetPlacementInvisible placementWithPlacement:]: Should not be called with an invisible placement
I thought it was because I didn't include a key in Info.plist, but I put keys in there that I thought might be needed.
I am using CloudKit sharing and silent push notifications for CloudKit subscriptions, and the Apple documentation says when I set the capabilities for background fetch and remote notifications, the keys would be put in Info.plist by Xcode.
Does this have anything to do with the fact that when my app is run for the first time it asks the user for permission to send notifications. If it's a silent notification that I'm using, I thought the documentation meant the user is not notified at all?
I have searched on the internet and on stack overflow and in Apple developer forums for a solution. Any help will be appreciated.
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags:
CloudKit
Background Tasks
User Notifications
I'm getting errors when I use NSKeyedArchiver and NSKeyedUnarchiver that works with iOS 15.5 but not with iOS 12.4 nor iOS 12.5.5. I have tried combinations of using devices and simulators. The error message appears in the Xcode debug window when the catch scope handles an error that occurs when the following statement executes:
try NSKeyedUnarchiver.unarchivedObject(ofClass: CNGroup.self, from: dataToUnarchive)
Here is what prints in the Xcode debug window for Error.localizedDescription:
The data couldn’t be read because it isn’t in the correct format.
Here is what prints in the Xcode debug window when only the Error object is put in the print statement parentheses:
Error Domain=NSCocoaErrorDomain Code=4864 "*** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: incomprehensible archive (0x62, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4)" UserInfo={NSDebugDescription=*** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: incomprehensible archive (0x62, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4)}
I found an answer to a similar question like this in Apple Developer Forums which had to do with NSCoder that indicated that the older iOS expects the Data object not to use secure coding, my code as this post concerns is not using secure coding. There are stackoverflow questions that deal with similar questions to mine, but they are very old and they deal with different facets of NSCoder.
The following are the respective function definitions for archive(cnGroup:completionHandler:) and unarchive(dataOfCNGroup:completionHandler) that I use.
Definition for unarchive(dataOfCNGroup:completionHandler)
func archive(cnGroup: CNGroup, completionHandler: @escaping (Result<Data, Error>)->Void) {
do {
if #available(iOS 11.0, *) {
let data: Data = try NSKeyedArchiver.archivedData(withRootObject: cnGroup, requiringSecureCoding: false)
completionHandler(.success(data))
} else {
let data: Data = NSKeyedArchiver.archivedData(withRootObject: cnGroup)
completionHandler(.success(data))
}
} catch {
completionHandler(.failure(error))
}
} // func archive(...) {...}
Definition for archive(cnGroup:completionHandler:)
func unarchive(dataOfCNGroup dataToUnarchive: Data, completionHandler: @escaping (Result<CNGroup, Error>)->Void) {
print("func unarchive(dataOfCNGroup dataToUnarchive: Data, completionHandler: @escaping (Result<CNGroup, Error>)->Void)")
do {
if let unwrappedUnarchivedCNGroup: CNGroup = try NSKeyedUnarchiver.unarchivedObject(ofClass: CNGroup.self, from: dataToUnarchive) {
completionHandler(.success(unwrappedUnarchivedCNGroup))
} else {
let nsError = NSError(domain: "func unarchive(dataOfCNGroup dataToUnarchive: Data, completionHandler: @escaping (Result<CNGroup, Error>?)->Void)", code: #line, userInfo: nil)
let error: Error = nsError
completionHandler(.failure(error))
return
}
} catch {
print("catch error in unarchive(dataOfCNGroup:_:) on line \(#line)")
print("\(error.localizedDescription)")
completionHandler(.failure(error))
}
} // func unarchive(...) {...}
Where can I find a list of those characters that can be put in front of the ""character in a string literal, such as "n", thus the following would print a new line?
I don't know what those characters are called. I thought they were called "escape characters" or "format specifiers".
print("\n", terminator: "")
What is createdUserRecordName record type metadata used for?
I can't find any information on it. I see it in CloudKit dashboard for every record type.
What would happen if I add an index to a record type in development that isn't there in production, then I deploy the development into production?
I would like my app to allow the Messages app to allow content shared with the user of the Messages app in iOS to automatically appear in my app when my app is selected in iOS Settings->Messages->Shared with You. I can't find information saying I can do this. The Share app extension doesn't enable this. Please someone say they know how to do this?
Is there a logical disjunction operator or function in Swift?
Even better, is there a logical disjunction that works with optional variables instead of boolean variables that returns an object when true, and returns nil when false?
A logical disjunction evaluates two boolean variables, and if at least one of them is true, then the return value is true. If neither variables is true, then the return value is false.
Topic:
Programming Languages
SubTopic:
Swift
Tags:
Swift
Swift Student Challenge
Education
Swift Packages
What criteria does Apple use to determine whether a vCard sent for example as an email attachment has a duplicate? I would think there has to be more in common between the duplicates than just the given name and the family name? Does Apple say whether the given name, family name, and address enough similarities to consider two contacts duplicates of each other?
I'm looking for the Swift tutorial that had always been used since I started learning Swift for the first time about 5 years ago. I can't remember the name. It was an app that reviewed restaurants, as I remember. I need a sample of key-value-coding. I recall that tutorial used key-value-coding.
Where is the “Use standard social compose interface” checkbox "in the Xcode target-adding pane" that the documentation for Share App Extension references in the "NOTE" grayed section under the "Use the Xcode Share Template"?
I am sure it's not where it says it is.
In this documentation for completeRequest(returningItems:completionHandler:), there is a box shaded yellow that says:
Important
If the system calls your block with an expired value of true, you must immediately suspend your app extension. If you fail to do this, the system terminates your extension’s process.
How does my app or my Share Extension know when the system calls the block spoken of?
Where is Apple's documentation of NSConcreteAttributedString?
I need to get the String from NSExtensionItem.attributedContentText property, which is of type NSConcreteAttributedString.
The intent property doesn't even show when I initialize an instance of NSExtensionContent, as in the following code:
let extensionContext = NSExtensionContext() extensionContext.intent
I get an error saying:
Value of type 'NSExtensionContext' has no member 'intent'
Why is this? The documentation doesn't say it is deprecated. Even when something is deprecated, it still shows in Xcode.