代码之家  ›  专栏  ›  技术社区  ›  João Amaro

如何声明对象的属性?[关闭]

  •  -2
  • João Amaro  · 技术社区  · 7 年前

    我在xcode中得到这个错误:

    在“xcuidevice”类型的对象上找不到属性“fb_screenshot”

    我该怎么申报?

    以下是我的部分代码:

    + (id<FBResponsePayload>)handleGetScreenshot:(FBRouteRequest *)request
    {
        [UtilsLogger logMessage:[NSString stringWithFormat:@"Handling : %@", request.URL.absoluteURL] sender:METHOD_NAME];
        @try {
            NSString *screenshot = [[XCUIDevice sharedDevice].fb_screenshot base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength];
            return [Response withSucessString:screenshot methodName:METHOD_NAME logString:false] ;
        }
        @catch (NSException *exception) {
            return [Response withException:exception methodName:METHOD_NAME];
        }
    }
    
    1 回复  |  直到 7 年前
        1
  •  1
  •   rob mayoff    7 年前

    看起来你想用 fb_screenshot 从旧版本的webdriveragentlib。方法已更改为 fb_screenshotWithError: 2017年11月1日,根据本承诺:

    https://github.com/facebook/WebDriverAgent/commit/79db77ed67ab04127b93e2d64f7a5837e3026227

    所以,要么你不导入 WebDriverAgentLib/Categories/XCUIDevice+FBHelpers.h ,或者您有一个较新的版本,并且您正在调用已删除的方法而不是替换方法。