我有一个使用iPhone的联系人的应用程序.使用iOS 6,第一次尝试时将提示用户输入联系人访问权限.此时,用户可以点击"允许"或"不允许".问题是当用户为应用程序提供背景,然后导航到"设置" - >"隐私" - >"联系人"以切换我的应用程序的"联系人"隐私设置.切换后,我可以在控制台上看到我的应用:
应用程序'UIKitApplication:com.myApp'异常退出,信号9:Killed:9
我在Apple的文档中找不到任何相关信息.有谁知道防止这种情况的方法?这是设计的吗?或者这是一个苹果虫?
我已经在我的 Mac 应用程序中成功实现了 10.11 版本的 NSCollectionView。它显示了我想要的 10 个项目,但我希望在应用程序启动时自动选择第一个项目。
我在 viewDidLoad 和 viewDidAppear 函数中尝试了以下操作;
let indexPath = NSIndexPath(forItem: 0, inSection: 0)
var set = Set<NSIndexPath>()
set.insert(indexPath)
collectionView.animator().selectItemsAtIndexPaths(set, scrollPosition: NSCollectionViewScrollPosition.Top)
Run Code Online (Sandbox Code Playgroud)
我已经尝试过上面的第 4 行,无论有没有动画师
我还尝试了以下方法来代替第 4 行
collectionView.animator().selectionIndexPaths = set
Run Code Online (Sandbox Code Playgroud)
有和没有 animator()
虽然它们都在选定的索引路径中包含索引路径,但实际上都没有将项目显示为选定的。
有什么线索我哪里出错了吗?
摘要
尝试编写代码,INSendPaymentIntent但无法区分具有相似名字的联系人。Siri 似乎在之后就开始循环INPersonResolutionResult.disambiguation(with: matchedContacts)
代码背后的想法
我最初选择使用联系人的名字来搜索联系人,因为INPerson如果用户仅指定名字,则使用显示名称会返回与查询匹配的第一个联系人。(即“向凯文支付 50 美元”将自动选择凯文·培根而不是凯文·史派西)。
不幸的是,使用给定的名字会使 Siri 陷入循环,要求用户一遍又一遍地指定联系人......
问题
有没有办法使用联系人的名字搜索联系人而不会让 Siri 陷入循环?
代码
func resolvePayee(forSendPayment intent: INSendPaymentIntent, with completion: (INPersonResolutionResult) -> Void) {
if let payee = intent.payee {
var resolutionResult: INPersonResolutionResult?
var matchedContacts: [INPerson] = []
let predicate = CNContact.predicateForContacts(matchingName: (payee.nameComponents?.givenName)!)
do {
let searchContactsResult = try CNContactStore().unifiedContacts(matching: predicate, keysToFetch:[CNContactGivenNameKey, CNContactFamilyNameKey, CNContactMiddleNameKey, CNContactPhoneNumbersKey, CNContactImageDataKey, CNContactIdentifierKey])
for contact in searchContactsResult {
matchedContacts.append(createContact((contact.phoneNumbers.first?.value.stringValue)!, contact: contact))
}
} catch {
completion(INPersonResolutionResult.unsupported())
} …Run Code Online (Sandbox Code Playgroud) 我试图用IOSOpenDev在Xcode中进行调整,但我遇到了一个错误Use of undeclared identifier "UIColor"!
我使用了我的iPhone中的相同代码,但它有效,为什么它不起作用?(我想使用IOSOpenDev,因为它看起来比使用theos好得多)
这是代码
%hook SBScreenFlash
-(void)flashColor:(id)color {
NSDictionary *prefs=[[NSDictionary alloc] initWithContentsOfFile:@"/var/mobile/Library/Preferences/com.junyi00.screenshotcolor.plist"];
if ([[prefs objectForKey:@"enable"] boolValue]){
color = [UIColor blueColor];
%orig(color); }
else {
%orig; }
}
%end
Run Code Online (Sandbox Code Playgroud)
请帮帮我