cycript access elements in JavaUtilArrays_ArrayList

39 Views Asked by At

I am running cycript on iOS and calling internal API in an App. I have a variable of type JavaUtilArrays_ArrayList returned from a call

cy# l

"[<FieldDescriptor: 0x170a74fc0>, <FieldDescriptor: 0x170a75a00>, <_FieldDescriptor: 0x170a76200>, <FieldDescriptor: 0x170a76240>, <FieldDescriptor: 0x170a76280>]"

I would like to iterate over this list to access the elements (preferably with #element)

In general I would iterate like so

for (x of [1,2,3]) {x+x}

However, trying

for (e of l){e} 

or

for(e in l ){l[e]}

results in throw new Error("*** _assert(static_cast(static_cast(value)) == value):../Execute.cpp(347):CYCastJSValue")

furthermore, accessing an individual element

l[0]

Return nothings

I am very new to cycript. Can anybody help me with this?

1

There are 1 best solutions below

0
user1247196 On

JavaUtilArrays_ArrayList was just another random objective-c object. I used class dump to find its definition and appropriate method to access the elements. I then called the method using objective c syntax [l getvaluefunc:]