ios - How to test if a variable is declared? -


I can test that an asset exists in this way:

  #import & Lt; Objc / runtime.h & gt; - (zero) testcachedPublicFeedExists {objc_property_t prop = class_getProperty ([store class], "cachedPublicFeed"); XCTAssertTrue (hop); }   

But how can I test if a class variable like cachedvar exists?

  @interfaceFTDataStoreBase: NSObject {NSMutableArray * cachedVar; }   

You can use these methods class_getInstanceVariable Or Class_getClassVariable .

  - (zero) testcachedVarExists {Ivar ivar = class_getInstanceVariable ([Store class], "CachedWire"); XCTAssertTrue (Ever); }   

Learn more.

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -