Arduino/Wifi Shield

Hello everyone
I've tried this code and it prints "Couldn't get a wifi connection"
Could it be the WIFI shield or the Arduino Version ?
I'm using the 1.8.3

#include <WiFi.h>

char ssid[] = "IAP";     //  your network SSID (name) 
char pass[] = "12345678";    // your network password
int status = WL_IDLE_STATUS;     // the Wifi radio's status

void setup() {
  // initialize serial:
  Serial.begin(9600);

  // attempt to connect using WPA2 encryption:
  Serial.println("Attempting to connect to WPA network...");
  status = WiFi.begin(ssid, pass);

  // if you're not connected, stop here:
  if ( status != WL_CONNECTED) { 
    Serial.println("Couldn't get a wifi connection");
    while(true);
  } 
  // if you are connected, print out info about the connection:
  else {
    Serial.println("Connected to network");
  }
}

void loop() {
  // do nothing
}

Could it be the WIFI shield

Or the WiFi shield's owner.

WHICH WiFi shield? How is it, or the Arduino, powered?

Which Arduino?

Is your WiFi network using WPA mode?

PaulS:
Or the WiFi shield's owner.

LOL I'm a beginner

it's a cc3000 wifi shield, and an Arduino UNO
My WIFI is a WPA2

it's a cc3000 wifi shield

Is that the official WiFi shield?

The Arduino-provided WiFi library is ONLY for the official WiFi shield.

My WIFI is a WPA2

So, you try to connect to it as though it as WPA, and that doesn't result in a connection. I can't imagine why not.

PaulS:
The Arduino-provided WiFi library is ONLY for the official WiFi shield.

Although it's written on it "UNO & MEGA Compatible ?"

So, you try to connect to it as though it as WPA, and that doesn't result in a connection. I can't imagine why not.

but the example is for a WPA2 also.

MREG:
Although it's written on it "UNO & MEGA Compatible ?"

That just means that the shield connections are compatible with being plugged into an Uno or a Mega. The WiFi library does not support your shield. You will need to find and install a 3rd party library that supports cc3000 and then use one of the example sketches included with the library as a reference to verify everything is working.

Alright tysm