[UIImage imageNamed:]
caches the image you're loading into memory. This is great if you want to reuse the same set of images over and over again, but if you are constantly showing different (or large) images, then you should use:
NSString *fileLocation = [[NSBundle mainBundle] pathForResource:fileName ofType:extension];
NSData *imageData = [NSData dataWithContentsOfFile:fileLocation];
[UIImage imageWithData:imageData];
instead.
According config/database.php
and .env
file that You show us everything is ok.
SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected
this means that database is not selected,
seems like have problem with existence of database,
or DB_NAME
does not get in config database
param.
There is some steps You've to check:
1) Check Your config/database.php
file contents to have such content:
<?php
return [
'fetch' => PDO::FETCH_CLASS,
'default' => 'mysql',
'connections' => [
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST'),
'database' => env('DB_DATABASE'),
'username' => env('DB_USERNAME'),
'password' => env('DB_PASSWORD'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false
],
'mysql2' => [
'driver' => 'mysql',
'host' => env('DB_HOST_ACADEMY'),
'database' => env('DB_DATABASE_ACADEMY'),
'username' => env('DB_USERNAME_ACADEMY'),
'password' => env('DB_PASSWORD_ACADEMY'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false
],
'mysql3' => [
'driver' => 'mysql',
'host' => env('DB_HOST_ACADEMY'),
'database' => env('DB_DATABASE_ACADEMY_DATE'),
'username' => env('DB_USERNAME_ACADEMY'),
'password' => env('DB_PASSWORD_ACADEMY'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false
]
],
'migrations' => 'migrations',
'redis' => [
'cluster' => false,
'default' => [
'host' => '127.0.0.1',
'port' => 6379,
'database' => 0
]
]
];
2) Check Your .env
file exist in Your app root and it's not .env.example
3) Check .env
file to have this line, if Yes so delete and copy-paste it from here (maybe spelling issue):
DB_DATABASE=gestion-inscriptions-v2
p.s. because of in Your question files are correct need more debug info, screenshot and etc. to see that problem is not with .env
or file system (maybe .env
file cannot be read).
Best Answer
I'd avoid using autoreleased objects where you can within a loop. If Instruments is reporting a lot of hits on the NSBundle pathForResource:ofType: call, I'd pull some of that processing outside of the loop.
My suggested implementation would look something like this:
You will be accumulating one autoreleased string (pathForImageFile), but that shouldn't be so bad. You could create and release an autorelease pool within the loop, but I would suggest doing that at most once every 10 or 100 loop passes, not every pass. Also, the retain and release on resourcePath may be superfluous, but I put it there in case you want to use your own autorelease pool somewhere in here.