Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
App16
iOS
Commits
e63c59ef
Commit
e63c59ef
authored
Mar 25, 2020
by
Grigor Aghabalyan
⚽
Browse files
Fix: iOS 12 black screen
parent
0d9a63b2
Changes
5
Hide whitespace changes
Inline
Side-by-side
App16/AppDelegate.swift
View file @
e63c59ef
...
...
@@ -6,93 +6,78 @@
// Copyright © 2020 X-TECH. All rights reserved.
//
import
UIKit
import
IQKeyboardManagerSwift
import
UserNotifications
@UIApplicationMain
class
AppDelegate
:
UIResponder
,
UIApplicationDelegate
{
func
application
(
_
application
:
UIApplication
,
didFinishLaunchingWithOptions
launchOptions
:
[
UIApplication
.
LaunchOptionsKey
:
Any
]?)
->
Bool
{
IQKeyboardManager
.
shared
.
enable
=
true
UNUserNotificationCenter
.
current
()
.
delegate
=
self
//Notifications
if
#available(iOS 10.0, *)
{
UNUserNotificationCenter
.
current
()
.
delegate
=
self
let
authOptions
:
UNAuthorizationOptions
=
[
.
alert
,
.
badge
,
.
sound
]
UNUserNotificationCenter
.
current
()
.
requestAuthorization
(
options
:
authOptions
,
completionHandler
:
{
_
,
_
in
})
}
else
{
let
settings
:
UIUserNotificationSettings
=
UIUserNotificationSettings
(
types
:
[
.
alert
,
.
badge
,
.
sound
],
categories
:
nil
)
application
.
registerUserNotificationSettings
(
settings
)
}
UIApplication
.
shared
.
registerForRemoteNotifications
()
application
.
registerForRemoteNotifications
()
var
window
:
UIWindow
?
func
application
(
_
application
:
UIApplication
,
willFinishLaunchingWithOptions
launchOptions
:
[
UIApplication
.
LaunchOptionsKey
:
Any
]?
=
nil
)
->
Bool
{
UINavigationBar
.
appearance
()
.
barTintColor
=
UIColor
(
red
:
0
/
255
,
green
:
137
/
255
,
blue
:
40
/
255
,
alpha
:
1
)
UINavigationBar
.
appearance
()
.
titleTextAttributes
=
[
NSAttributedString
.
Key
.
foregroundColor
:
UIColor
.
white
]
UINavigationBar
.
appearance
()
.
tintColor
=
.
white
UINavigationBar
.
appearance
()
.
isTranslucent
=
false
if
#available(iOS 13.0, *)
{
// In iOS 13 setup is done in SceneDelegate
}
else
{
let
window
=
UIWindow
(
frame
:
UIScreen
.
main
.
bounds
)
self
.
window
=
window
let
mainstoryboard
:
UIStoryboard
=
UIStoryboard
(
name
:
"Main"
,
bundle
:
nil
)
let
newViewcontroller
:
UIViewController
=
mainstoryboard
.
instantiateViewController
(
withIdentifier
:
"MainViewController"
)
as!
MainViewController
window
.
rootViewController
=
newViewcontroller
}
IQKeyboardManager
.
shared
.
enable
=
true
return
true
}
func
application
(
_
application
:
UIApplication
,
did
RegisterForRemoteNotificationsWithDeviceToken
deviceToken
:
Data
)
{
print
(
"APNs token retrieved:
\(
deviceToken
)
"
)
let
tokenParts
=
deviceToken
.
map
{
data
->
String
in
return
String
(
format
:
"%02.2hhx"
,
data
)
func
application
(
_
application
:
UIApplication
,
did
FinishLaunchingWithOptions
launchOptions
:
[
UIApplication
.
LaunchOptionsKey
:
Any
]?)
->
Bool
{
if
#available(iOS 13.0, *)
{
// In iOS 13 setup is done in SceneDelegate
}
else
{
self
.
window
?
.
makeKeyAndVisible
(
)
}
let
token
=
tokenParts
.
joined
()
print
(
token
)
UserDefaultsHelper
.
set
(
alias
:
.
deviceToken
,
value
:
token
)
return
true
}
func
applicationWillResignActive
(
_
application
:
UIApplication
)
{
// Not called under iOS 13 - See SceneDelegate sceneWillResignActive
}
func
applicationDidEnterBackground
(
_
application
:
UIApplication
)
{
// Not called under iOS 13 - See SceneDelegate sceneDidEnterBackground
}
func
applicationWillEnterForeground
(
_
application
:
UIApplication
)
{
// Not called under iOS 13 - See SceneDelegate sceneWillEnterForeground
}
func
applicationDidBecomeActive
(
_
application
:
UIApplication
)
{
// Not called under iOS 13 - See SceneDelegate sceneDidBecomeActive
}
// MARK: UISceneSession Lifecycle
@available
(
iOS
13.0
,
*
)
func
application
(
_
application
:
UIApplication
,
configurationForConnecting
connectingSceneSession
:
UISceneSession
,
options
:
UIScene
.
ConnectionOptions
)
->
UISceneConfiguration
{
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return
UISceneConfiguration
(
name
:
"Default Configuration"
,
sessionRole
:
connectingSceneSession
.
role
)
}
@available
(
iOS
13.0
,
*
)
func
application
(
_
application
:
UIApplication
,
didDiscardSceneSessions
sceneSessions
:
Set
<
UISceneSession
>
)
{
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
// [START ios_10_message_handling]
@available
(
iOS
10
,
*
)
extension
AppDelegate
:
UNUserNotificationCenterDelegate
{
// Receive displayed notifications for iOS 10 devices.
func
userNotificationCenter
(
_
center
:
UNUserNotificationCenter
,
willPresent
notification
:
UNNotification
,
withCompletionHandler
completionHandler
:
@escaping
(
UNNotificationPresentationOptions
)
->
Void
)
{
// let userInfo = notification.request.content.userInfo
// if let messageID = userInfo[gcmMessageIDKey] {
// print("Message ID: \(messageID)")
// }
// Print full message.
// print(userInfo)
// Change this to your preferred presentation option
completionHandler
([])
}
}
App16/Base.lproj/Main.storyboard
View file @
e63c59ef
...
...
@@ -11,7 +11,7 @@
<!--Main View Controller-->
<scene
sceneID=
"tne-QT-ifu"
>
<objects>
<viewController
id=
"BYZ-38-t0r"
customClass=
"MainViewController"
customModule=
"App16"
customModuleProvider=
"target"
sceneMemberID=
"viewController"
>
<viewController
storyboardIdentifier=
"MainViewController"
id=
"BYZ-38-t0r"
customClass=
"MainViewController"
customModule=
"App16"
customModuleProvider=
"target"
sceneMemberID=
"viewController"
>
<view
key=
"view"
contentMode=
"scaleToFill"
id=
"8bC-Xf-vdC"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"414"
height=
"896"
/>
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
heightSizable=
"YES"
/>
...
...
App16/SceneDelegate.swift
View file @
e63c59ef
...
...
@@ -12,13 +12,11 @@ import UIKit
class
SceneDelegate
:
UIResponder
,
UIWindowSceneDelegate
{
var
window
:
UIWindow
?
func
scene
(
_
scene
:
UIScene
,
willConnectTo
session
:
UISceneSession
,
options
connectionOptions
:
UIScene
.
ConnectionOptions
)
{
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
guard
let
_
=
(
scene
as?
UIWindowScene
)
else
{
return
}
}
func
sceneDidDisconnect
(
_
scene
:
UIScene
)
{
...
...
@@ -48,7 +46,4 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}
}
App16/Views/Form/Create/FormCreateViewController.xib
View file @
e63c59ef
...
...
@@ -32,7 +32,7 @@
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"414"
height=
"896"
/>
<subviews>
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"Kwt-kc-N2e"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"414"
height=
"6
46
"
/>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"414"
height=
"6
21
"
/>
<subviews>
<view
contentMode=
"scaleToFill"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"Azo-7T-DFW"
customClass=
"IQPreviousNextView"
customModule=
"IQKeyboardManagerSwift"
>
<rect
key=
"frame"
x=
"40"
y=
"55"
width=
"334"
height=
"50"
/>
...
...
@@ -292,7 +292,7 @@
<constraint
firstAttribute=
"trailing"
secondItem=
"NyF-FR-xam"
secondAttribute=
"trailing"
constant=
"40"
id=
"De8-qX-Ukc"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"JD7-Yf-hQj"
secondAttribute=
"trailing"
constant=
"40"
id=
"DlW-PC-fOe"
/>
<constraint
firstItem=
"NyF-FR-xam"
firstAttribute=
"leading"
secondItem=
"Kwt-kc-N2e"
secondAttribute=
"leading"
constant=
"40"
id=
"FI1-KC-yTn"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"NyF-FR-xam"
secondAttribute=
"bottom"
constant=
"
45
"
id=
"FW4-Nj-AYg"
/>
<constraint
firstAttribute=
"bottom"
secondItem=
"NyF-FR-xam"
secondAttribute=
"bottom"
constant=
"
20
"
id=
"FW4-Nj-AYg"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"XIU-P6-Fzz"
secondAttribute=
"trailing"
constant=
"40"
id=
"GAa-mM-fJ1"
/>
<constraint
firstItem=
"D1C-8s-tPP"
firstAttribute=
"leading"
secondItem=
"Kwt-kc-N2e"
secondAttribute=
"leading"
constant=
"40"
id=
"JBl-Oe-bk3"
/>
<constraint
firstAttribute=
"trailing"
secondItem=
"Azo-7T-DFW"
secondAttribute=
"trailing"
constant=
"40"
id=
"KFI-Av-Xcb"
/>
...
...
App16/Views/Main/MainViewController.swift
View file @
e63c59ef
...
...
@@ -62,5 +62,4 @@ class MainViewController: UIViewController {
}
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment