小编Yag*_*iya的帖子

从包含User类对象的NSMutableArray获取属性的唯一对象

@interface User : NSManagedObject
@property (nonatomic, retain) NSString * user_name;
@property (nonatomic, retain) NSString * group_id;
@end
Run Code Online (Sandbox Code Playgroud)

NSMutableArray包含User类型的对象集我希望基于属性检索唯一对象user_name 意味着我想防止重复user_name


NSMutableArray *arrayBikePartsFiltering = [NSMutableArray new];

arrayAsFoundSubPart = @[@{
                           partid:12,
                           name : @"Silencer"
                          },
                          @{
                           partid:11,
                           name : @"Gear"
                           },
                          @{
                               partid:13,
                               name : @"Break"
                           },
                          @{
                               partid:12,
                               name : @“Silencer”
                           },];

        for (BikeParts *subPart in arrayAsFoundSubPart) {
            
            BOOL isFound = NO;
            for (BikeParts *subPartl2 in array BikeParts Filtering) {
                if ([[subPartl2.part_id stringValue] isEqualToString:[subPart.part_id stringValue]]) {
                    isFound = YES; …
Run Code Online (Sandbox Code Playgroud)

iphone ios

5
推荐指数
1
解决办法
92
查看次数

最后在XCUI TestCase期间停止在UITableView上滚动

在我的一个UITableView有超过10行.我想在UITestCase跑步时滚到最后一排.

我写下面的代码滚动到最后一行.

-(void)scrollToElement:(XCUIElement *)element application:(XCUIApplication *)app{
    while ([self visible:element withApplication:app]) {
        XCUIElement *searchResultTableView = app.tables[@"searchResultView"];
        XCUICoordinate *startCoord = [searchResultTableView coordinateWithNormalizedOffset:CGVectorMake(0.5, 0.5)];
        XCUICoordinate *endCoord = [startCoord coordinateWithOffset:CGVectorMake(0.0, -262)];
        [startCoord pressForDuration:0.01 thenDragToCoordinate:endCoord];
    }
}
-(BOOL)visible:(XCUIElement *)element withApplication:(XCUIApplication *)app{
    if (element.exists && !CGRectIsEmpty(element.frame) && element.isHittable) {
        return CGRectContainsRect([app.windows elementBoundByIndex:0].frame, element.frame);
    } else {
        return FALSE;
    }
}
Run Code Online (Sandbox Code Playgroud)

UITestCase通过下面的代码在我的方法之一中调用了上面的方法

XCUIElement *searchResultTableView = app.tables[@"searchResultView"];
[self waitForElementToAppear:searchResultTableView withTimeout:30];


XCUIElement *table = [app.tables elementBoundByIndex:0];
XCUIElement *lastCell = [table.cells elementBoundByIndex:table.cells.count - 1]; …
Run Code Online (Sandbox Code Playgroud)

ios xcode-ui-testing xcuitest

5
推荐指数
1
解决办法
702
查看次数

如何直接从 iPad 应用程序使用 AFNetworking 上传图像

我是iOS 的新手。我想使用AFNetworking将图像上传到我的服务器。我试过了,但还是没有完成。请帮助我,提前致谢

ipad ios afnetworking

4
推荐指数
1
解决办法
3712
查看次数

在 UITestCase 期间使用可访问性标识符识别 UISearchBar

我有一个UISearchBar在我的一个UIViewController。但UISearchBar默认情况下没有可访问性标识符,因此我尝试使用“用户定义运行时属性”来定义手动可访问性标识符。

在此处输入图片说明

但是在UITestCase编写过程中,我无法UISearchBar使用“用户定义运行时属性”访问或识别。但我无法使用标识符访问它。我总是不得不使用我不想使用的占位符文本,因为它在支持“多语言”时会导致问题。

我已经参考了有关此问题的堆栈溢出答案,但没有一个符合我的要求。

请帮助提供解决方案。谢谢你。

ios xcode-ui-testing

2
推荐指数
1
解决办法
1563
查看次数

标签 统计

ios ×4

xcode-ui-testing ×2

afnetworking ×1

ipad ×1

iphone ×1

xcuitest ×1