Übergabe-App für Immobilienmakler

Immobilienmakler aufgepasst: heute erblickte die neue App zur Haus- bzw. Wohnungsübergabe die Welt! Die Übergabe-App wiegt 36 Mb, dem Entwickler und dem Baby der App geht es gut 😉

Was macht denn die App so besonderes? Sie ist EINFACH. Intuitiv aufgebaut, keine Anmeldung erforderlich. Die Protokoll-Daten können als PDF direkt per Email verschickt werden.

Was noch? Das Potenzial! Die Übergabe-App ist sehr flexibel gebaut, so dass dem Ausbau und den speziellen Anforderungen nichts im Wege steht! Sprecht uns gerne an, falls irgendwelche Features vermisst werden oder gewünscht sind! Fürs Feedback schon mal Danke im Voraus! 😉

Die LieferscheinApp ist da!

Fröhliche Nachrichten – die LieferscheinApp steht ab sofort für alle iPhone- und iPad-Nutzer zur Verfügung. Es handelt sich dabei um einen Lieferscheinblock für Rundholztransport. Kommt es etwa bekannt vor? Ja natürlich, HISLIS! Die LieferscheinApp ist zwar nicht ganz das gleiche wie die Android Umsetzung, geht aber in die gleiche Richtung. Es umfasst die Möglichkeit, die üblichen Lieferscheinfelder auszufüllen, Holzdaten zu erfassen und Fotos anzuhängen. In der Test-Phase sind auch Pro Features freigeschaltet: PDF-, CSV- und Email-Export. Wir freuen uns auf euer Feedback!

HISLIS bei Google Play

Ab heute steht der digitale Lieferscheinblock HISLIS bei Google Play zur Installation bereit. Etwa 1 Jahr lang hat die Test-Phase bei Bentheimer Holz GmbH gedauert. Nun ist es soweit. Lange Laufzeiten für das manuelle übermitteln der Lieferscheine gehören somit bei Rundholztransport der Vergangenheit an.

Die HISGIS-App beinhaltet insbesondere die Anbindung an Holz-Informationssystem von Bentheimer Holz. Bitte sprecht uns an, wenn die Anbindung an Euer Backendsysteme ebenso gewünscht ist.

PolterApp Version 4.x

Last three weeks of the ongoing development of the PolterApp were dedicated to the implementation of the Feedback from the USA. Especially, it turned out that localization of the PolterApp in English left much to be desired. Thanks to constructive suggestions and notes the dropdown values for species, kind and quality have been reorganized and completed with new entries. The list of wood certifications has been also extended. To make the things easier in the future, it became possible for the user to add his own list values in the App settings! Do not worry, it is still possible to put plain text into corresponding fields.

The localization of the PolterApp into English is now almost finished. Please, let me know if you still find some text that is not correct or should had a better wording. You help is highly appreciated!

SWIFT: Upload a file with multipart/form-data in iOS using uploadTask and URLSession

Let’s see how to upload any file to a web server, using only Apple’s built-in URLSession. Most of the examples in the Internet utilize dataTask and not the uploadTask. Also the examples I found demonstrate only the uploading of the image files. That’s why I decided to share a working code for building up a multipart/form-data request, that can be used in combination with uploadTask.

// generate boundary string using a unique string
let boundary = UUID().uuidString
        
// Set the URLRequest to POST and to the specified URL
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.addValue("Bearer \(yourAuthorizationToken)", forHTTPHeaderField: "Authorization")
        
// Content-Type is multipart/form-data, this is the same as submitting form data with file upload
// in a web browser
request.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
        
let fileName = fileURL.lastPathComponent
let mimetype = mimeType(for: fileName)
let paramName = "file"
let fileData = try? Data(contentsOf: fileURL)
var data = Data()
// Add the file data to the raw http request data
data.append("\r\n--\(boundary)\r\n".data(using: .utf8)!)
data.append("Content-Disposition: form-data; name=\"\(paramName)\"; filename=\"\(fileName)\"\r\n".data(using: .utf8)!)
data.append("Content-Type: \(mimetype)\r\n\r\n".data(using: .utf8)!)
        data.append(fileData!)
        data.append("\r\n--\(boundary)--\r\n".data(using: .utf8)!)
// do not forget to set the content-length!
request.setValue(String(data.count), forHTTPHeaderField: "Content-Length")

As you can see, it’s pretty straightforward. First we create a request, setting Content-Type to “multipart/form-data” and Authorization token if required. You can set any other values if you web service requires. The second is to create the data that confirms to the multipart/form-data protocol. For we want to upload any kind of files, the mime type is recognized automatically:

private func mimeType(for path: String) -> String {
        let pathExtension = URL(fileURLWithPath: path).pathExtension as NSString
        guard
            let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension, nil)?.takeRetainedValue(),
            let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue()
        else {
            return "application/octet-stream"
        }

        return mimetype as String
    }

So now we have two peaces of puzzle. To bring them together just use the uploadTask(with:data:) function:

session.uploadTask(with: request, from: data)

The webservice should be happy now with your upload file call.

SWIFT: Save NSAttributedString into text file

To save NSAttributedString string into text file we convert first NSAttributedString into Data and afterwards save Data as usual into a text file:

do {
   let rtfData = try attributedText.data(from: .init(location: 0, length: attributedText.length), documentAttributes: [.documentType: NSAttributedString.DocumentType.rtf])
   try rtfData.write(to: fileURL, options: .atomic)
} catch {
   print(error)
}

SWIFT: Insert substring into string

Working with Strings in Swift is quite different then in Objective-C. Inserting a substring into a string is pretty tricky. Let’s assume following task: given is a html string and we want to extend it by adding some style, i.e. we want to add a string of type <style>/**some style*/</style>
before closing tag </head>. Of course, there is a number of ways how to realize it, e.g JavaScript injection, XML manipulation etc. But let’s see how it can be done using Strings’ operations.

Base idea: we split our HTML string into two parts using String[Range<String.Index>] subscript: before </head> and after </head>. Then we concatenate these parts: part1 + styleString + part2. And this is how it looks in code:

        let styleString = String(format: "<style>%@</style>", cssString)
        var enrichedHtmlString = htmlString
        if let range = enrichedHtmlString.range(of: "</head>") {
            let substringPrefix = enrichedHtmlString[enrichedHtmlString.startIndex..<range.lowerBound]
            let substringSuffix = enrichedHtmlString[range.lowerBound ..< enrichedHtmlString.endIndex]
            enrichedHtmlString = substringPrefix + styleString + substringSuffix
        }

Feel free to contact me if you find a better way to realise inserting substrings into strings in Swift.

PolterApp Version 3.7

Es wurde Unterstützung für den iOS 13 “Dunklen” Modus eingebaut. Polter bei Nacht zu erfassen macht nun noch mehr Spaß 😉 Es wurde außerdem ein kleiner Fehler beim Polterstatus behoben. Die Auswahlwerte sind nun richtig ins deutsche übersetzt.

PolterApp Version 3.6

Fehlerbehebung: App stürzt nicht mehr ab, wenn Stammerfassungsmaske nach dem iPhone-Drehen verlassen wird 

###

Fehlerbehebung: das Löschen eines Polters setzt die Polterliste nicht mehr in den Bearbeitungsmodus

###

Weitere iOS 13 Anpassungen