我正在使用新的Xcode 7 UI测试功能编写UI测试用例.在我的应用程序的某些时刻,我要求用户允许相机访问和推送通知.因此会出现两个iOS弹出窗口:"MyApp Would Like to Access the Camera"弹出窗口和"MyApp Would Like to Send You Notifications"弹出窗口.我希望我的测试可以解雇两个弹出窗口.
UI录制为我生成了以下代码:
[app.alerts[@"cameraAccessTitle"].collectionViews.buttons[@"OK"] tap];
Run Code Online (Sandbox Code Playgroud)
但是,[app.alerts[@"cameraAccessTitle"] exists]解析为false,上面的代码生成错误:Assertion Failure: UI Testing Failure - Failure getting refresh snapshot Error Domain=XCTestManagerErrorDomain Code=13 "Error copying attributes -25202".
那么在测试中解除一堆系统警报的最佳方法是什么?系统弹出窗口会中断我的应用程序流并立即使我的正常UI测试用例失败.事实上,任何有关如何绕过系统警报以便我可以恢复测试通常流程的建议都表示赞赏.
这个问题可能与这个SO帖子有关,也没有答案:Xcode7 | Xcode UI测试| 如何处理位置服务警报?
提前致谢.
我正在观察SecItemCopyMatching在锁定的手机上执行iOS 8推送通知时引发的设备控制台中的钥匙串错误.详细的重复步骤如下:
didFinishLaunchingWithOptions被调用,试图访问钥匙串项目.运行时SecItemCopyMatching,Access to item attempted while keychain is locked设备控制台中会显示错误.完整的错误日志如下所示.最后一行给出了应用程序特定的错误消息.
ReportCrash[32481] <Error>: task_set_exception_ports(B07, 400, D03, 0, 0) failed with error (4: (os/kern) invalid argument)
ReportCrash[32481] <Notice>: ReportCrash acting against PID 31423
diagnosticd[32258] <Error>: error evaluating process info - pid: 31423, punique: 131317
ReportCrash[32481] <Notice>: Formulating crash report for process cfprefsd[31423]
com.apple.xpc.launchd[1] (com.apple.cfprefsd.xpc.daemon[31423]) <Notice>: Service exited due to signal: Bus error: 10
My App[32480] <Error>: assertion failed: 12F70: …Run Code Online (Sandbox Code Playgroud) 当UITableView处于编辑模式时,有没有办法自定义减号删除按钮的颜色?设计师需要它是一个更深的红色,以符合我们的应用程序的配色方案.请注意,我在谈论左侧的圆圈减号删除图标,而不是右侧的删除确认按钮:
SO帖子中,我发现如这一个是所有关于定制在右侧的删除确认按钮.
我在iOS 8上的推送通知中添加了两个操作按钮:一个Accept按钮和一个Deny按钮.这两个按钮都不会打开应用程序,但根据按下的按钮,将会发出不同的服务器请求.这是我的设置:
+ (void)requestForPushNotificationToken {
UIApplication *application = [UIApplication sharedApplication];
// if ios 8 or greater
if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) {
UIMutableUserNotificationAction *acceptAction = [[UIMutableUserNotificationAction alloc] init];
[acceptAction setActivationMode:UIUserNotificationActivationModeBackground];
[acceptAction setTitle:@"Accept"];
[acceptAction setIdentifier:@"ACCEPT_ACTION"];
[acceptAction setDestructive:NO];
[acceptAction setAuthenticationRequired:NO];
UIMutableUserNotificationAction *denyAction = [[UIMutableUserNotificationAction alloc] init];
[denyAction setActivationMode:UIUserNotificationActivationModeBackground];
[denyAction setTitle:@"Deny"];
[denyAction setIdentifier:@"DENY_ACTION"];
[denyAction setDestructive:NO];
[denyAction setAuthenticationRequired:NO];
UIMutableUserNotificationCategory *actionCategory = [[UIMutableUserNotificationCategory alloc] init];
[actionCategory setIdentifier:@"ACTIONABLE"];
[actionCategory setActions:@[acceptAction, denyAction]
forContext:UIUserNotificationActionContextDefault];
NSSet *categories = [NSSet setWithObject:actionCategory];
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound …Run Code Online (Sandbox Code Playgroud) 我需要更新钥匙串条目的kSecAttrAccessible。我不需要更新实际数据,只需更新可访问性属性即可。
首先,我尝试找到该项目以确保我的查询字典良好:
sanityCheck = SecItemCopyMatching((__bridge CFDictionaryRef)(queryPrivateKey), (void *)&privateKeyRef);
Run Code Online (Sandbox Code Playgroud)
此行成功找到我要查找的商品(返回码为0)。
然后,使用相同的查询更新kSecAttrAccessible属性:
if (sanityCheck == noErr && privateKeyRef != nil) {
// found it, update accessibility
NSMutableDictionary *updatedAttributes = [[NSMutableDictionary alloc] init];
updatedAttributes[(__bridge id)kSecAttrAccessible] = (__bridge id)kSecAttrAccessibleAlways;
OSStatus updateItemStatus = SecItemUpdate((__bridge CFDictionaryRef)queryPrivateKey, (__bridge CFDictionaryRef)updatedAttributes);
}
Run Code Online (Sandbox Code Playgroud)
此时,updateItemStatus为-50(paramErr)。
我看了一下这个线程:是否可以更新钥匙串项目的kSecAttrAccessible值?
但是我的问题是不同的。即使我将kSecValueData添加到我的代码,它也会返回-50updatedAttributes。此外,文档还指出,我们仅需要为iOS 4和更早版本添加kSecValueData。我支持iOS 7及更高版本,所以这不是我的问题。
有人可以指出我在这里想念的东西吗?非常感谢。
我的 Android 通知有操作按钮。当我连续发送两个通知时,点击第一个通知上的操作按钮不会产生任何效果(操作处理程序代码不会执行),但点击最新通知上的操作按钮会按预期工作。
private void displayNotification(Context context, ChallengeInformation extras) {
/* build the notification */
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.status_bar_icon)
.setContentTitle(context.getString(R.string.push_notification_title))
.setStyle(new NotificationCompat.BigTextStyle()
.bigText(getChallengeContextString(extras)))
.setContentText(context.getString(R.string.push_notification_description))
.setAutoCancel(false) // We don't want to cancel when the user clicks
.setPriority(NotificationCompat.PRIORITY_MAX)
.setColor(context.getResources().getColor(R.color.notification))
.setLocalOnly(true) // we handle notifications on Wear separately
.setDefaults(DEFAULTS);
/* set the target of the notification */
PendingIntent challenge =
getChallengePendingIntent(context, extras);
mBuilder.setContentIntent(challenge);
addNotificationActions(mBuilder, context, extras);
challengeTracker.notifyChallenge(extras, context, mBuilder.build());
}
private void addNotificationActions(NotificationCompat.Builder builder, Context context,
ChallengeInformation extras) {
//add buttons …Run Code Online (Sandbox Code Playgroud) notifications android push-notification android-notifications google-cloud-messaging
我以前在Xcode 4.0中有一个项目.它运行时没有任何警告或错误.我刚把它移到了Xcode 5.0.在摆脱了大量错误后,我现在留下了数百个相同的警告:"属性不可用.在6.0之前的iOS版本上调整字母间距." 警告出现在我的xib文件中.任何人都知道导致警告的原因以及如何摆脱它们?
提前致谢!
ios ×5
objective-c ×4
ios8 ×2
keychain ×2
android ×1
ios7 ×1
uitableview ×1
xcode5 ×1
xcode7 ×1
xctest ×1