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?
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:]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.