“This is the second day of my participation in the Gwen Challenge in November. See details: The Last Gwen Challenge in 2021”
Why do we need to bury them?
- When the volume of the business reaches a certain level, it is necessary to analyze and study these user data, which can be mined out a lot of potential value.
- Even if the business is in the early stage, collecting statistical user data will bring some new directions to the update and iteration of the business, rather than blindly expanding some unnecessary functions.
- Analysis of user behavior, for the improvement of the program is also some, relatively buried point is also a technology, or worth studying.
Buried point solutions
-
Code buried point
Code burying should be the most commonly used by programmers, but also the simplest way of burying code, which needs to be written into business logic. The advantage of this way is that the code of burying code has a high degree of freedom, but the disadvantage is that the workload will become very large
-
All buried point
Full buried point should also be a very popular way of buried point, the technical requirements are still a little, the advantage is that the overall buried point, save a lot of work, the disadvantage is also obvious, if the function of a piece of the need for very detailed statistics, then it will be very limited
-
Visual burial point
Visual buried point is also called no-code buried point. In simple terms, it is the operation personnel through the operation on the background management page to realize the buried point function, which is a certain challenge for technology. The advantage is to simplify the logic of buried point, the operation personnel is more convenient to use, and the disadvantages are somewhat similar to full buried point. Is that there are some need APP dynamic data is not statistical.
conclusion
Order buried three ways have their own advantages and disadvantages, three methods should be integrated in the practical business use, combine their respective strengths complement each other, so that the business of the commission, buried among the three implementation point, of course, as well as the way of technology has a certain improvement of oneself, the current I also buried in some work in progress, if you have a good idea, Let me know in the comment section, thank you!
The attachment
#include <ifaddrs.h> #include <sys/stat.h> #include <sys/mount.h> #import <sys/utsname.h> #import <Security/Security.h> /// device IP + (NSString *) IP {int sockfd = socket(AF_INET, SOCK_DGRAM, 0); NSMutableArray *ips = [NSMutableArray array]; int BUFFERSIZE = 4096; struct ifconf ifc; char buffer[BUFFERSIZE], *ptr, lastname[IFNAMSIZ], *cptr; struct ifreq *ifr, ifrcopy; ifc.ifc_len = BUFFERSIZE; ifc.ifc_buf = buffer; if (ioctl(sockfd, SIOCGIFCONF, &ifc) >= 0) { for (ptr = buffer; ptr < buffer + ifc.ifc_len; ) { ifr = (struct ifreq *)ptr; int len = sizeof(struct sockaddr); if (ifr->ifr_addr.sa_len > len) { len = ifr->ifr_addr.sa_len; } ptr += sizeof(ifr->ifr_name) + len; if (ifr->ifr_addr.sa_family ! = AF_INET) continue; if ((cptr = (char *)strchr(ifr->ifr_name, ':')) ! = NULL) *cptr = 0; if (strncmp(lastname, ifr->ifr_name, IFNAMSIZ) == 0) continue; memcpy(lastname, ifr->ifr_name, IFNAMSIZ); ifrcopy = *ifr; ioctl(sockfd, SIOCGIFFLAGS, &ifrcopy); if ((ifrcopy.ifr_flags & IFF_UP) == 0) continue; NSString *ip = [NSString stringWithFormat:@"%s", inet_ntoa(((struct sockaddr_in *)&ifr->ifr_addr)->sin_addr)]; [ips addObject:ip]; } } close(sockfd); NSString *deviceIP = @""; for (int i = 0; i < ips.count; i++) { if (ips.count > 0) { deviceIP = [NSString stringWithFormat:@"%@",ips.lastObject]; } } return deviceIP; }Copy the code