简体   繁体   中英

Cannot convert to a pointer type

I'm trying to consume an ASP.net Web service, and found a utility called WSDL2ObjC. Now I'm trying to use it, and basic use is working (asking for simple data types, such as booleans or strings), but now I'm requesting an array of the "EmailServiceSvc_Email" structure, which contains "subject", "from" and "message" properties.

The app won't compile, with the message above, and here's the code on wich it gets stuck:

EmailServiceSvc_Email * eml = (EmailServiceSvc_Email *) arrEmails[[indexPath row]];

This is the explanation of the variables:

  • eml : the new variable I'm trying to get out of arrEmails.
  • arrEmails: an NSMutableArray of the EmailServiceSvc_Email object
  • indexPath: the indexPath parameter, this is from the cellForRowAtIndexPath function.

As you can see probably, I want to display all the "subject"s from the "EmailServiceSvc_Email" structure in a TableView, on the iPhone.

To get an element out of an NSMutableArray you must use -objectAtIndex: . The a[i] syntax does not work with NSArrays.

EmailServiceSvc_Email* eml = [arrEmails objectAtIndex:indexPath.row];

I wrote a tutorial about Wsdl2objc and complex types:

http://brismith66.blogspot.com/2010/07/iphone-development-accessing-soap.html

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM