ios - NSString fails as a parameter, but literal string works? -
I'm pulling an array of songs from my AWS server
My next step is to send those flowing URLs to As a request to recover, one of those song names is to be used.
// [1] Start S3 Client self.s3 = [[[AmazonS3Client alloc] initWithAccessKey: @ "Blah" with Sqwet: @ "Blah"]; Self.s3.endpoint = [AmazonEndpoints s3Endpoint: US_WEST_2]; // [2] Get an array of song names NSArray * song_array = [self.s3 listObjectsInbacket: @ "blahblah"]; NSLogs (@ "objects% @", songs_array) are; // [3] Get the name of the single song from the array NSString * song1 = [[NSString alloc] init]; Song1 = (NSString *) [song_array objectAdWords: 1]; NSLog (@ "% @", song 1); NSString * song2 = @ "Wrap the MP3."; NSLog (@ "% @", song2); // [4] Get the song URL S3GetPreSignedURLRequest * gpsur = [[S3GetPreSignedURLRequest alloc] init]; Gpsur.key = song2; Gpsur.bucket = @ "SoundShark"; GPSer.XPier = [Date of NSDT; currentInternational: (NSTEMine Intervalor) 3600]; NSError * error; NSURL * url = [self.s3 getPreSignedURL: GPASER error: & amp; Error]; NSLog (@ "url% @", URL) is;
The Song2 parameter works perfectly as gpsur.key
However, if I use the song 1 as a 1 parameter, then This fails with error
'NSInvalidArgumentException' due to cancellation of 'API' with no exception, reason: '- [S3ObjectSummary stringWithURlecoding]: sent to unknown selector for example 0x175aef30
When I use NSLog, both songs 1 and song 2 exact string "rap god. Ampe 3 "prints
Why error? Why can not I use the string from the array? Does it have the exact same value?
change
NSString * song1 = [[NSString alloc] int ]; Song1 = (NSString *) [song_array objectAdWords: 1]; NSLog (@ "% @", song 1);
to
S3ObjectSummary * s3object = [song_array objectAtIndex: 1]; NSString * song1 = [s3object description]; NSLog (@ "% @", song 1);
If this works, it would be better to change
NSString * song1 = [s3object description];
to
NSString * song1 = [s3object etag];
or
NSString * song1 = [s3object key];
I'm not familiar with S3ObjectSummary so I can not suggest which type is better.
Comments
Post a Comment