See My code below.
This works so far if I only use the field password for output. See line "Here 
is the problem"

When changing to this instead, which should work in my opinion, I get Errors: 
txtGesamt.text = txtGesamt.text + "\(res.username), \(res.password)  \n"

/Users/ronny/Dropbox/CoreDataYouTube/vcMain.swift:73:16: 'AnyObject' does not 
have a member named 'username'

What I donĀ“t understand. If res.password is correct  res.username should work 
as well.
What am I doing wrong? Any idea?

Greetings from Switzerland, Ronald Hofmann
---  

My code:
func btnLoadWrapper ( myFlag: Bool ) {
                
        var appDel :AppDelegate = (UIApplication.sharedApplication().delegate 
as AppDelegate )
        var context:NSManagedObjectContext = appDel.managedObjectContext
                
        var request = NSFetchRequest(entityName: "Users")
        request.returnsObjectsAsFaults = false
                
        txtGesamt.text   = ""                                                   
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                                                                                
                // clearing UITextView

        request.predicate = NSPredicate (format: "username = 
%@",txtUsername.text)
                
        var results:NSArray = context.executeFetchRequest(request, error: nil)
                
        if(results.count > 0) {                                         
                        
                        for res in results {                                    
                                //Writing the contents into UITextView txtGesamt
                                                                                
                                println("\(res)")                       
//returns result 1
Here is the problem             txtGesamt.text = txtGesamt.text + 
"\(res.password)  \n" //see result 2
                        }
                }
        }


result 1
<NSManagedObject: 0x7ff5925657d0> (entity: Users; id: 0xd000000000800000 
<x-coredata://04772CE3-D027-4770-A536-D8A3B12CBFB6/Users/p32 
<x-coredata://04772CE3-D027-4770-A536-D8A3B12CBFB6/Users/p32>> ; data: {
    password = MyPassword;
    reference = Gargantua20;
    username = EuroMillions;

result 2 appear in txtGesamt (these passwords actually change)
MyPassword
MyPassword
.
.
.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to