9 Notes July 2021

1. CleverTap Push notification APNs Bad Device Token

When I'ill use clevetap found this error in clevertap


Solution is:
-  I try check this link doc 
https://developer.clevertap.com/docs/ios

*Other solution
- reupload apns auth token
- logout app and relogin app again
- Change APNs push mode 
- If you use environment development or production

https://github.com/CleverTap/clevertap-react-native/issues/136#issuecomment-794749653



2.  Add value and key in dictionary [String: Any]

I need to add new key and value into dict so this a solution

example:

var props: [String: Any] = [
    "action": "click",
    "Type": "Mobile"
]

print(props) // ["action": "click", "Type": "Mobile"]

props["Metfo"] = "jan"
props["data"] = "PM"

print(props).   ["Metfo": "jan", "Type": "Mobile", "data": "PM", "action": "click"]


3. Error Build app is "Xcode setting ENABLE_BITCODE"

You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target

How to fix in setting

source: https://stackoverflow.com/a/32011218/8366535

4. Error Missing Module "No Such module"

Xcode 12.5 In Setting project -> general -> In section frameworks, libraries, and Embedded Content
add missing module in here 
click button plus "+" add the missing framework/ module if you not found that select "Add Other.." and select "Add Files.."

After that you must build again your project it must be okey.


5. Error: Could not build Objective-C module "MyFramework"

When get this happens fixing with this flow

- Change the scheme to target error example "MyFramework" or if you use pod "Alamofire"

- Build (⌘B)

- Change back to scheme .development or .production

- Run app 

another solution when failed build in CI/CD

- In Setting app project select general -> Frameworks and Libraries
- add "+" error module "MyFramework"
- Build and run

source: https://stackoverflow.com/a/44486792/8366535


6. Crash Attempt to insert non-property list object

When I already use userdefaulf and set data model with model use enum and run app get this error

Error inde bug area: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Attempt to insert non-property list object
Solution: Change value data from model to string

// From:
UserDefaults.standard.set(type, forKey: "key")
// To UserDefaults.standard.set(type.rawValue, forKey: "key")

7.  Undo Last Git Commit with reset

When I forget to git push -f origin branch/name after rebase, for fixing that I need commit in terminal to undo git pull or igin branch/name this code below.

$ git reset --soft HEAD~1


8. Add external user to test firebase app distribution

Error from user: “This project does not exist or you do not have permission to view it

Solution:
add user UUID in apple developer account and build again your app example build jenkins or other CI/CD like bitrise

Note: After add UUID in apple developer account you must build again in CI/CD because preovisioning profile development or production itu create new certificate to access you (.ipa) in firebase app distribution.


9.  Fixing warning "didReceiveNotificationResponse " never called

I found this error/ warning in debug area 


2021-08-06 10:42:03.101638+0700 TestNotificationServicesExtension[12077:111068] Warning: UNUserNotificationCenter delegate received call to -userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler: but the completion handler was never called.


Solution: add completionHandler() inside didReceiveNotificationResponse 

// Before
 func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
        print(response.notification.request.content.userInfo)
}


// After
 func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
        print(response.notification.request.content.userInfo)
        completionHandler()
    }



No comments: