2016-06-03 7 views
0

I Bild zu zeigen, haben in imageViewSDWebImage mitBild hochladen in Imageview innerhalb Kollektion mit sdwebimage

Hier ist mein Code:

NSString *string2 = [[dataArray objectAtIndex:indexPath.row ]valueForKey:@"logo"]; 

[imagev sd_setImageWithURL:[NSURL URLWithString:@"http://dev-demo.info.bh-in-15.webhostbox.net/dv/nationalblack/upload/post/"] 
        placeholderImage:[UIImage imageNamed:string2] 
         completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { 
          imagev.image = image; 
}]; 

Ich bin kein Bild innerhalb ImageView bekommen

Daten, die ich vom Server bekomme, ist

data array (
     { 
     address = brisbane; 
     amount = 0; 
     "business_phone" = 9990688436; 
     catid = 0; 
     catname = ""; 
     city = delhi; 
     contactperson = "Gautam Kumar"; 
     country = Australia; 
     createdon = 1464935578; 
     email = "[email protected]"; 
     expirydays = 366; 
     expirymail = 0; 
     "fb_address" = ""; 
     id = 78; 
     "inst_address" = ""; 
     isexpired = 0; 
     isfeatured = 0; 
     lat = "-33.7961"; 
     "link_address" = ""; 
     lng = "151.146"; 
     logo = ""; 
     longdesc = "xyz "; 
     mobileno = ""; 
     officephone = ""; 
     ondedaysmail = 0; 
     "package_name" = 0; 
     paidamount1 = 0; 
     paydate1 = 0; 
     paystatus1 = 1; 
     "prod_name" = 13; 
     "pt_address" = ""; 
     sevendaysmail = 0; 
     shortdesc = hello123; 
     state = "New South Wales"; 
     status = 1; 
     tags = ""; 
     "tb_address" = ""; 
     title = aayush; 
     transcationid1 = ""; 
     "tw_address" = ""; 
     userid = 5; 
     username = "Gautam Kumar"; 
     "var_name" = 56; 
     "web_address" = ""; 
    }, 
     { 
     address = "Address 1"; 
     amount = 0; 
     "business_phone" = 9990688436; 
     catid = 0; 
     catname = ""; 
     city = ABD; 
     contactperson = "Gautam Kumar"; 
     country = Australia; 
     createdon = 1464158696; 
     email = "[email protected]"; 
     expirydays = 357; 
     expirymail = 0; 
     "fb_address" = ""; 
     id = 75; 
     "inst_address" = ""; 
     isexpired = 0; 
     isfeatured = 0; 
     lat = "-37.488"; 
     "link_address" = ""; 
     lng = "144.592"; 
     logo = "appflowchart_4c1.gif"; 
     longdesc = "This is short Description."; 
     mobileno = ""; 
     officephone = ""; 
     ondedaysmail = 0; 
     "package_name" = 0; 
     paidamount1 = 0; 
     paydate1 = 0; 
     paystatus1 = 1; 
     "prod_name" = 3; 
     "pt_address" = ""; 
     sevendaysmail = 0; 
     shortdesc = "This is short Description."; 
     state = Gisborne; 
     status = 1; 
     tags = ""; 
     "tb_address" = ""; 
     title = Business1; 
     transcationid1 = ""; 
     "tw_address" = ""; 
     userid = 5; 
     username = "Gautam Kumar"; 
     "var_name" = 0; 
     "web_address" = ""; 
    }, 
     { 
     address = "Paschim Vihar ,Delhi"; 
     amount = 0; 
     "business_phone" = 9990688436; 
     catid = 0; 
     catname = ""; 
     city = "New Delhi"; 
     contactperson = "Gautam Kumar"; 
     country = Australia; 
     createdon = 1464065014; 
     email = "[email protected]"; 
     expirydays = 356; 
     expirymail = 0; 
     "fb_address" = Facebook; 
     id = 72; 
     "inst_address" = Instagram; 
     isexpired = 0; 
     isfeatured = 0; 
     lat = "-37.488"; 
     "link_address" = linked; 
     lng = "144.592"; 
     logo = "Screenshot_(1)_61b.png"; 
     longdesc = sdfsdfdsf; 
     mobileno = ""; 
     officephone = ""; 
     ondedaysmail = 0; 
     "package_name" = 0; 
     paidamount1 = 0; 
     paydate1 = 0; 
     paystatus1 = 1; 
     "prod_name" = 3; 
     "pt_address" = Pinsta; 
     sevendaysmail = 0; 
     shortdesc = fffsdf; 
     state = Gisborne; 
     status = 1; 
     tags = ""; 
     "tb_address" = Tumbler; 
     title = "First business"; 
     transcationid1 = ""; 
     "tw_address" = Twitter; 
     userid = 5; 
     username = "Gautam Kumar"; 
     "var_name" = 2; 
     "web_address" = Website; 
    }, 
     { 
     address = Laxminagar; 
     amount = 0; 
     "business_phone" = 9990688436; 
     catid = 0; 
     catname = ""; 
     city = "New Delhi1"; 
     contactperson = "Gautam Kumar"; 
     country = Australia; 
     createdon = 1463651418; 
     email = "[email protected]"; 
     expirydays = 7; 
     expirymail = 0; 
     "fb_address" = Facebook; 
     id = 61; 
     "inst_address" = Instagram; 
     isexpired = 0; 
     isfeatured = 0; 
     lat = "28.6433"; 
     "link_address" = linked; 
     lng = "77.0363"; 
     logo = "Screenshot_(1)_0ba.png"; 
     longdesc = asxasxasx; 
     mobileno = ""; 
     officephone = ""; 
     ondedaysmail = 0; 
     "package_name" = 0; 
     paidamount1 = 0; 
     paydate1 = 0; 
     paystatus1 = 1; 
     "prod_name" = 3; 
     "pt_address" = Pinsta; 
     sevendaysmail = 0; 
     shortdesc = xasxasx; 
     state = Victoria; 
     status = 1; 
     tags = ""; 
     "tb_address" = Tumbler; 
     title = "Testing by Gautam"; 
     transcationid1 = 1111111111111; 
     "tw_address" = Twitter; 
     userid = 5; 
     username = "Gautam Kumar"; 
     "var_name" = 2; 
     "web_address" = Website; 
    } 
) 
+0

Was ist Ihr Entwicklungsziel ??? –

+1

Ich denke, Sie brauchen einen vollständigen Pfad zu Ihrem Image im Server nicht nur Screenshot_ (1) _61b.png und Ihre NSURL sollte aussehen wie [NSURL URLWithString: @ "http: //dev-demo.info.bh-in -15.webhostbox.net/dv/nationalblack/upload/post/Screenshot_(1)_0ba.png "]' – iSashok

+0

aber es gibt nicht nur ein Bild, es gibt verschiedene Bilder, so dass jede Zelle ein anderes Bild zeigt @iSashok –

Antwort

0

Aayush Katiyar,

Von iOS 8 ab Sie sind nicht verwenden http soll Sie sollten https Verwendung sicherer Kanäle machen. Falls Sie nicht haben eine Addiert man diese zu Ihrem plist betrachten

<key>NSAppTransportSecurity</key> 
<dict> 
    <key>NSAllowsArbitraryLoads</key> 
    <true/> 
</dict> 

Alle Ihr Bild herunterladen api ist die Verwendung von http machen: // ich denke, das könnte das Problem sein hier

schließlich so, wie Sie laden ändern das Bild als

[imagev sd_setImageWithURL:[NSURL URLWithString: [NSString stringWithFormat:@"%@/%@",@"http://dev-demo.info.bh-in-15.webhostbox.net/dv/nationalblack/upload/post/", string2]] 
        placeholderImage:[UIImage imageNamed:@"Some_Placeholder_Image"] 
         completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) { 
          imagev.image = image; 
}]; 
+0

Ich habe diese Sache schon gemacht –

+0

@ aayush-katiyar: Hast du es versucht Lade Bild wie ich in meiner Antwort erwähnt habe ??? –

+0

funktioniert nicht Ihren Code :( –

0

Genau wie diese,

[cell.myImageView sd_setImageWithURL:finalImageUrl]; 

finalImageUrl ist Ihr endgültiges url für das Downloadbild.

Keine Notwendigkeit, Methode mit Completion-Handlerl zu verwenden. es ist für verschiedene Aufgaben.

+0

Ich bekomme kein Bild immer noch in meinem imageview @ lion –

+0

dann überprüfen Sie Ihre URL es ist gültig oder nicht – Lion

+0

ja ich überprüfe bereits die URL ii gibt mir Dataarray @Lion –