Em chào anh ạ! Em đang học lập trình, cấu trúc code nhiều khi em vẫn không hiểu lắm. Hiện em đang muốn tải ảnh về từ webview ios. Em có tìm trên mạng đoạn code và chèn đoạn code vào ví dụ của mình. Như sau ạ: import UIKit import WebKit import Network
class ViewController: UIViewController , WKNavigationDelegate, WKDownloadDelegate{
@IBOutlet weak var webview: WKWebView!
override func viewDidLoad() {
super.viewDidLoad()
monitorNetwork()
}
func monitorNetwork(){
let monitor = NWPathMonitor()
monitor.pathUpdateHandler = {
path in
if path.status == .satisfied{
DispatchQueue.main.async {
self.webview.navigationDelegate = self
let urlString = URL(string: "http://subdomain1.mywebsite.com.vn")
let request = URLRequest(url: urlString!)
self.webview.load(request)
}
}else{
DispatchQueue.main.async {
self.Alert(Message: "Thiết bị không kết nối mạng")
}
}
}
let queue = DispatchQueue(label: "Network")
monitor.start(queue: queue)
Sau khi chạy hệ thống báo lỗi như sau: App Transport Security has blocked a cleartext HTTP connection to http://subdomain1.mywebsite.com.vn since it is insecure. Use HTTPS instead or add this domain to Exception Domains in your Info.plist.
Mặc dù em đã thêm subdomain vào file infor rồi ạ. NHỜ ANH CHỈ RÙM EM VỚI Ạ. Cái nữa, liệu trong phần kiểm tra .linkActivated trên ( trước đó khi kích vào link xem ảnh chi tiết web chạy về 1 subdomain2 và tải ảnh từ link gốc subdomain2 liệu được không ạ?)
Em chào anh ạ! Em đang học lập trình, cấu trúc code nhiều khi em vẫn không hiểu lắm. Hiện em đang muốn tải ảnh về từ webview ios. Em có tìm trên mạng đoạn code và chèn đoạn code vào ví dụ của mình. Như sau ạ: import UIKit import WebKit import Network
class ViewController: UIViewController , WKNavigationDelegate, WKDownloadDelegate{
@IBOutlet weak var webview: WKWebView!
override func viewDidLoad() {
super.viewDidLoad()
monitorNetwork()
}
func monitorNetwork(){
let monitor = NWPathMonitor()
monitor.pathUpdateHandler = {
path in
if path.status == .satisfied{
DispatchQueue.main.async {
self.webview.navigationDelegate = self
let urlString = URL(string: "http://subdomain1.mywebsite.com.vn")
let request = URLRequest(url: urlString!)
self.webview.load(request)
}
}else{
DispatchQueue.main.async {
self.Alert(Message: "Thiết bị không kết nối mạng")
}
}
}
let queue = DispatchQueue(label: "Network")
monitor.start(queue: queue)
Sau khi chạy hệ thống báo lỗi như sau: App Transport Security has blocked a cleartext HTTP connection to http://subdomain1.mywebsite.com.vn since it is insecure. Use HTTPS instead or add this domain to Exception Domains in your Info.plist.
Mặc dù em đã thêm subdomain vào file infor rồi ạ. NHỜ ANH CHỈ RÙM EM VỚI Ạ. Cái nữa, liệu trong phần kiểm tra .linkActivated trên ( trước đó khi kích vào link xem ảnh chi tiết web chạy về 1 subdomain2 và tải ảnh từ link gốc subdomain2 liệu được không ạ?)
Em chào anh ạ!
Em đang học lập trình, cấu trúc code nhiều khi em vẫn không hiểu lắm.
Hiện em đang muốn tải ảnh về từ webview ios. Em có tìm trên mạng đoạn code và chèn đoạn code vào ví dụ của mình.
Như sau ạ:
import UIKit
import WebKit
import Network
class ViewController: UIViewController , WKNavigationDelegate, WKDownloadDelegate{
@IBOutlet weak var webview: WKWebView!
override func viewDidLoad() {
super.viewDidLoad()
monitorNetwork()
}
func monitorNetwork(){
let monitor = NWPathMonitor()
monitor.pathUpdateHandler = {
path in
if path.status == .satisfied{
DispatchQueue.main.async {
self.webview.navigationDelegate = self
let urlString = URL(string: "http://subdomain1.mywebsite.com.vn")
let request = URLRequest(url: urlString!)
self.webview.load(request)
}
}else{
DispatchQueue.main.async {
self.Alert(Message: "Thiết bị không kết nối mạng")
}
}
}
let queue = DispatchQueue(label: "Network")
monitor.start(queue: queue)
}
func Alert (Message: String){
let alert = UIAlertController(title: "Thông báo", message: Message, preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: "Đồng ý", style: UIAlertAction.Style.default, handler: nil))
self.present(alert, animated: true, completion: nil)
}
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
if let url = navigationAction.request.url, navigationAction.navigationType == .linkActivated {
if url.absoluteString.hasSuffix(".pdf") || url.absoluteString.hasSuffix(".doc") ||
url.absoluteString.hasSuffix(".docx") || url.absoluteString.hasSuffix(".xls") ||
url.absoluteString.hasSuffix(".xlsx") || url.absoluteString.hasSuffix(".jpg") || url.absoluteString.hasSuffix(".jpeg") || url.absoluteString.hasSuffix(".png") || url.absoluteString.hasSuffix(".ppt") || url.absoluteString.hasSuffix(".pptx") {
// let fileURL : String = url.absoluteString;
let downloadTask = URLSession.shared.downloadTask(with: url) {
urlOrNil, responseOrNil, errorOrNil in
// check for and handle errors:
// * errorOrNil should be nil
// * responseOrNil should be an HTTPURLResponse with statusCode in 200..<299
guard let fileURL = urlOrNil else { return }
do {
let documentsURL = try
FileManager.default.url(for: .documentDirectory,
in: .userDomainMask,
appropriateFor: nil,
create: false)
let savedURL = documentsURL.appendingPathComponent(fileURL.lastPathComponent)
try FileManager.default.moveItem(at: fileURL, to: savedURL)
} catch {
print ("file error: \(error)")
}
}
downloadTask.resume()
/* URLSession.shared.downloadTask(with: url, completionHandler: { (tempURL, response, error) in
print("finished fetching \(url.absoluteString)")
}).resume()
*/
/* DispatchQueue.main.async {
let url = URL(string: fileURL)
let pdfData = try? Data.init(contentsOf: url!)
let resDocPath = (FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).last!) as URL
let pdfFileName = "\(UUID().uuidString).jpg"
let filePath = resDocPath.appendingPathComponent(pdfFileName)
// Save to File
do {
try pdfData?.write(to: filePath,options: .atomic)
print("File Saved")
} catch {
print("Some Error in code")
}
}
*/
decisionHandler(.cancel)
return
}
}
decisionHandler(.allow)
}
func webView(_ webView: WKWebView, navigationResponse: WKNavigationResponse, didBecome download: WKDownload) {
download.delegate = self;
}
func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: @escaping (WKNavigationResponsePolicy) -> Void) {
if navigationResponse.canShowMIMEType {
decisionHandler(.allow)
} else {
decisionHandler(.download)
}
}
// Download Delegate (to allow downloading PDF)
func download(_ download: WKDownload, decideDestinationUsing response: URLResponse, suggestedFilename: String) async -> URL? {
let urls = FileManager.default.urls(for: .documentDirectory, in: .allDomainsMask)
// for Japanese names.
let name = suggestedFilename.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "cannotencode"
return URL(string: name, relativeTo: urls[0])
}
}
Code file infor.plist như sau:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
Sau khi chạy hệ thống báo lỗi như sau:
App Transport Security has blocked a cleartext HTTP connection to http://subdomain1.mywebsite.com.vn since it is insecure. Use HTTPS instead or add this domain to Exception Domains in your Info.plist.
Mặc dù em đã thêm subdomain vào file infor rồi ạ.
NHỜ ANH CHỈ RÙM EM VỚI Ạ.
Cái nữa, liệu trong phần kiểm tra .linkActivated trên ( trước đó khi kích vào link xem ảnh chi tiết web chạy về 1 subdomain2 và tải ảnh từ link gốc subdomain2 liệu được không ạ?)
Đây là những khó khăn mình từng gặp khi làm việc với DynamoDB. Nếu có điểm nào chưa đúng hoặc cần bổ sung, rất mong mọi người góp ý và cùng chia sẻ thêm giải pháp để hoàn thiện hơn nhé! 🙇
Atomic operation chủ yếu phù hợp với các tác vụ đơn giản, nó không phù hợp với yêu cầu phức tạp với nhiều điều kiện đi kèm => bạn cho mình ví dụ phức tạp như thế nào là ko dùng đc cái này đc ko ?
Bài viết giới thiệu tổng quan về Deep Learning thật sự rất hay và bổ ích! Tác giả đã trình bày một cách dễ hiểu, từ các khái niệm cơ bản đến ứng dụng thực tiễn, giúp người đọc dễ dàng nắm bắt nội dung. Đặc biệt, việc giải thích các thuật ngữ phức tạp một cách rõ ràng và minh họa bằng các ví dụ cụ thể đã tạo nên sự thu hút và sinh động cho bài viết. Đây chắc chắn là một tài liệu tham khảo hữu ích cho những ai mới bắt đầu tìm hiểu về Deep Learning. Cảm ơn tác giả đã chia sẻ kiến thức giá trị này!
THẢO LUẬN
Em chào anh ạ! Em đang học lập trình, cấu trúc code nhiều khi em vẫn không hiểu lắm. Hiện em đang muốn tải ảnh về từ webview ios. Em có tìm trên mạng đoạn code và chèn đoạn code vào ví dụ của mình. Như sau ạ: import UIKit import WebKit import Network
class ViewController: UIViewController , WKNavigationDelegate, WKDownloadDelegate{
@IBOutlet weak var webview: WKWebView! override func viewDidLoad() { super.viewDidLoad()
} func monitorNetwork(){ let monitor = NWPathMonitor() monitor.pathUpdateHandler = { path in if path.status == .satisfied{ DispatchQueue.main.async { self.webview.navigationDelegate = self let urlString = URL(string: "http://subdomain1.mywebsite.com.vn") let request = URLRequest(url: urlString!) self.webview.load(request) } }else{ DispatchQueue.main.async { self.Alert(Message: "Thiết bị không kết nối mạng") }
}
func Alert (Message: String){
}
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { if let url = navigationAction.request.url, navigationAction.navigationType == .linkActivated {
}
func webView(_ webView: WKWebView, navigationResponse: WKNavigationResponse, didBecome download: WKDownload) { download.delegate = self; }
func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: @escaping (WKNavigationResponsePolicy) -> Void) { if navigationResponse.canShowMIMEType { decisionHandler(.allow) } else { decisionHandler(.download) } }
// Download Delegate (to allow downloading PDF) func download(_ download: WKDownload, decideDestinationUsing response: URLResponse, suggestedFilename: String) async -> URL? { let urls = FileManager.default.urls(for: .documentDirectory, in: .allDomainsMask) // for Japanese names. let name = suggestedFilename.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "cannotencode" return URL(string: name, relativeTo: urls[0]) }
} Code file infor.plist như sau:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><dict> <key>CFBundleGetInfoString</key> <string></string> <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> <key>NSAllowsArbitraryLoadsInWebContent</key> <true/> <key>NSExceptionDomains</key> <dict> <key>http://subdomain1.mywebsite.com.vn</key> <string></string> </dict> </dict> <key>UIApplicationSceneManifest</key> <dict> <key>UIApplicationSupportsMultipleScenes</key> <false/> <key>UISceneConfigurations</key> <dict> <key>UIWindowSceneSessionRoleApplication</key> <array> <dict> <key>UISceneConfigurationName</key> <string>Default Configuration</string> <key>UISceneDelegateClassName</key> <string>$(PRODUCT_MODULE_NAME).SceneDelegate</string> <key>UISceneStoryboardFile</key> <string>Main</string> </dict> </array> </dict> </dict> </dict>
Sau khi chạy hệ thống báo lỗi như sau: App Transport Security has blocked a cleartext HTTP connection to http://subdomain1.mywebsite.com.vn since it is insecure. Use HTTPS instead or add this domain to Exception Domains in your Info.plist.
Mặc dù em đã thêm subdomain vào file infor rồi ạ. NHỜ ANH CHỈ RÙM EM VỚI Ạ. Cái nữa, liệu trong phần kiểm tra .linkActivated trên ( trước đó khi kích vào link xem ảnh chi tiết web chạy về 1 subdomain2 và tải ảnh từ link gốc subdomain2 liệu được không ạ?)
Em chào anh ạ! Em đang học lập trình, cấu trúc code nhiều khi em vẫn không hiểu lắm. Hiện em đang muốn tải ảnh về từ webview ios. Em có tìm trên mạng đoạn code và chèn đoạn code vào ví dụ của mình. Như sau ạ: import UIKit import WebKit import Network
class ViewController: UIViewController , WKNavigationDelegate, WKDownloadDelegate{
@IBOutlet weak var webview: WKWebView! override func viewDidLoad() { super.viewDidLoad()
} func monitorNetwork(){ let monitor = NWPathMonitor() monitor.pathUpdateHandler = { path in if path.status == .satisfied{ DispatchQueue.main.async { self.webview.navigationDelegate = self let urlString = URL(string: "http://subdomain1.mywebsite.com.vn") let request = URLRequest(url: urlString!) self.webview.load(request) } }else{ DispatchQueue.main.async { self.Alert(Message: "Thiết bị không kết nối mạng") }
}
func Alert (Message: String){
}
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { if let url = navigationAction.request.url, navigationAction.navigationType == .linkActivated {
}
func webView(_ webView: WKWebView, navigationResponse: WKNavigationResponse, didBecome download: WKDownload) { download.delegate = self; }
func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: @escaping (WKNavigationResponsePolicy) -> Void) { if navigationResponse.canShowMIMEType { decisionHandler(.allow) } else { decisionHandler(.download) } }
// Download Delegate (to allow downloading PDF) func download(_ download: WKDownload, decideDestinationUsing response: URLResponse, suggestedFilename: String) async -> URL? { let urls = FileManager.default.urls(for: .documentDirectory, in: .allDomainsMask) // for Japanese names. let name = suggestedFilename.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "cannotencode" return URL(string: name, relativeTo: urls[0]) }
} Code file infor.plist như sau:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><dict> <key>CFBundleGetInfoString</key> <string></string> <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> <key>NSAllowsArbitraryLoadsInWebContent</key> <true/> <key>NSExceptionDomains</key> <dict> <key>http://subdomain1.mywebsite.com.vn</key> <string></string> </dict> </dict> <key>UIApplicationSceneManifest</key> <dict> <key>UIApplicationSupportsMultipleScenes</key> <false/> <key>UISceneConfigurations</key> <dict> <key>UIWindowSceneSessionRoleApplication</key> <array> <dict> <key>UISceneConfigurationName</key> <string>Default Configuration</string> <key>UISceneDelegateClassName</key> <string>$(PRODUCT_MODULE_NAME).SceneDelegate</string> <key>UISceneStoryboardFile</key> <string>Main</string> </dict> </array> </dict> </dict> </dict>
Sau khi chạy hệ thống báo lỗi như sau: App Transport Security has blocked a cleartext HTTP connection to http://subdomain1.mywebsite.com.vn since it is insecure. Use HTTPS instead or add this domain to Exception Domains in your Info.plist.
Mặc dù em đã thêm subdomain vào file infor rồi ạ. NHỜ ANH CHỈ RÙM EM VỚI Ạ. Cái nữa, liệu trong phần kiểm tra .linkActivated trên ( trước đó khi kích vào link xem ảnh chi tiết web chạy về 1 subdomain2 và tải ảnh từ link gốc subdomain2 liệu được không ạ?)
Em chào anh ạ! Em đang học lập trình, cấu trúc code nhiều khi em vẫn không hiểu lắm. Hiện em đang muốn tải ảnh về từ webview ios. Em có tìm trên mạng đoạn code và chèn đoạn code vào ví dụ của mình. Như sau ạ: import UIKit import WebKit import Network
class ViewController: UIViewController , WKNavigationDelegate, WKDownloadDelegate{
} Code file infor.plist như sau:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><dict> <key>CFBundleGetInfoString</key> <string></string> <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> <key>NSAllowsArbitraryLoadsInWebContent</key> <true/> <key>NSExceptionDomains</key> <dict> <key>http://subdomain1.mywebsite.com.vn</key> <string></string> </dict> </dict> <key>UIApplicationSceneManifest</key> <dict> <key>UIApplicationSupportsMultipleScenes</key> <false/> <key>UISceneConfigurations</key> <dict> <key>UIWindowSceneSessionRoleApplication</key> <array> <dict> <key>UISceneConfigurationName</key> <string>Default Configuration</string> <key>UISceneDelegateClassName</key> <string>$(PRODUCT_MODULE_NAME).SceneDelegate</string> <key>UISceneStoryboardFile</key> <string>Main</string> </dict> </array> </dict> </dict> </dict>
Sau khi chạy hệ thống báo lỗi như sau: App Transport Security has blocked a cleartext HTTP connection to http://subdomain1.mywebsite.com.vn since it is insecure. Use HTTPS instead or add this domain to Exception Domains in your Info.plist.
Mặc dù em đã thêm subdomain vào file infor rồi ạ. NHỜ ANH CHỈ RÙM EM VỚI Ạ. Cái nữa, liệu trong phần kiểm tra .linkActivated trên ( trước đó khi kích vào link xem ảnh chi tiết web chạy về 1 subdomain2 và tải ảnh từ link gốc subdomain2 liệu được không ạ?)
Đây là những khó khăn mình từng gặp khi làm việc với DynamoDB. Nếu có điểm nào chưa đúng hoặc cần bổ sung, rất mong mọi người góp ý và cùng chia sẻ thêm giải pháp để hoàn thiện hơn nhé! 🙇
GORM nó chỉ nhận là orm library, bác lại ném nó thành framework bài viết cũng lấy từ nguồn https://dev.to/empiree/top-5-popular-frameworks-and-libraries-for-go-in-2024-c6n 2024 chỉnh lại thành 2025, ảo thật
Bạn dịch khó hiểu qúa. Ví dụ với cách diễn đạt sơ sài quá
Atomic operation chủ yếu phù hợp với các tác vụ đơn giản, nó không phù hợp với yêu cầu phức tạp với nhiều điều kiện đi kèm => bạn cho mình ví dụ phức tạp như thế nào là ko dùng đc cái này đc ko ?
sợ chỉ là cảm giác thôi e
)
có bác nào làm module gửi link forgot password khi user yêu cầu chưa ạ, cho em xin bài hướng dẫn
Có hình ảnh hoặc video mô tả cho từng loại thì dễ hình dung hơn
đăng bài đừng đi copy paste như thế nhé cháu
em toàn để kiến thức ngấm vào người chứ sợ viết blog sai 😁
Bài viết giới thiệu tổng quan về Deep Learning thật sự rất hay và bổ ích! Tác giả đã trình bày một cách dễ hiểu, từ các khái niệm cơ bản đến ứng dụng thực tiễn, giúp người đọc dễ dàng nắm bắt nội dung. Đặc biệt, việc giải thích các thuật ngữ phức tạp một cách rõ ràng và minh họa bằng các ví dụ cụ thể đã tạo nên sự thu hút và sinh động cho bài viết. Đây chắc chắn là một tài liệu tham khảo hữu ích cho những ai mới bắt đầu tìm hiểu về Deep Learning. Cảm ơn tác giả đã chia sẻ kiến thức giá trị này!
Nếu vậy thì API Gateway sẽ đóng vai trò gì trong kiến trúc này nhỉ? Mình mãi vẫn không hiểu, mong bạn giúp đỡ
Cảm ơn Hải vì bài viết hữu ích
Sao lại vớ vẩn hả anh? Cái này em hỏi thật, vì em thấy sau khi em submit hàng loạt lỗi như vậy thì nó bị đánh out of scope luôn mà nhỉ?
Vớ va vớ vẩn, content ko thấy đâu chỉ giật title là giỏi
Bạn cho mình xin video hướng dẫn lại qua mail: nguyenduclongwin@gmail.com với ạ. Cảm ơn bạn nhiều
Ở backend gặp bug còn từ từ lần mò ra được, chứ frontend đôi khi gặp bug mà không biết nó nằm ở đâu để mà mò
Đúng kiểu bài viết chọn người luôn. Phải login +1 cho bác. Bác biết sao việc mở port mà nó lây lan mình được k