zoukankan      html  css  js  c++  java
  • 应用更新iOS 开发:应用内实现 更新提醒

    本篇文章是一篇关于应用更新的帖子

        前目绝大多数的应用都可以实现应用更新后,打开应用能就失掉更新提示。这有利于用户的更新。

        

            关于如何实现的式方,很多人希望Xcode本身可以供提响应的API来实现对应用本版的查找,但就前目来看,还没有这样的API。因此,前目的解决办法有两种:

        

    1、自己架设服务器,当应用更新后,就在自己的服务器中更新本版信息,然后让应用接连服务器来查找本版信息,与前当应用本版核查,如果更新则提示

        

    2、用利App Store的Search-api,通过响应的api,request可以失掉响应的应用信息,关键是JSON式格的,因此就很方面临本版信息行进取提然后比对。上面是址网:

        

    http://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html

        

    可以看到,只要用使https://itunes.apple.com/lookup?id=595176741 这样的url行进request,id要换成地点应用的id,然后就可以失掉JSON式格的信息。

        

    上面是以应用 3D量角器为例可以失掉如下JSON信息:

        

    {

        

     "resultCount":1,

        

     "results": [

        

    {"kind":"software", "features":["iosUniversal"], "supportedDevices":["iPodTouchourthGen", "iPad2Wifi", "iPad23G", "iPhone4"], "isGameCenterEnabled":false, "artistViewUrl":"https://itunes.apple.com/us/artist/hongkun-song/id595176744?uo=4", "artworkUrl60":"http://a86.phobos.apple.com/us/r1000/091/Purple2/v4/0a/db/51/0adb5130-5d18-0b98-d1cc-3ddd114b10d5/icon57_57.png", 

        

    "screenshotUrls":["http://a1960.phobos.apple.com/us/r1000/108/Purple/v4/ea/52/80/ea52802a-c7d9-1dca-defe-937fb61bbc3e/mzl.ghupvxyw.png", "http://a1740.phobos.apple.com/us/r1000/110/Purple2/v4/58/40/64/584064d8-1d3b-6704-3bf7-3b1c771d25c1/mzl.ydpovfzk.png", "http://a180.phobos.apple.com/us/r1000/100/Purple2/v4/22/01/90/22019008-314d-07e7-49e4-2359983058c0/mzl.hefjpqiw.png", "http://a1862.phobos.apple.com/us/r1000/107/Purple/v4/ee/23/a6/ee23a69f-768f-5fe8-9444-298a26330faa/mzl.sxiofdqt.png", "http://a980.phobos.apple.com/us/r1000/102/Purple/v4/cd/2c/9f/cd2c9fff-8dac-b75d-f260-c223ea8d2b33/mzl.trozlblw.png"], 

        

    "ipadScreenshotUrls":["http://a651.phobos.apple.com/us/r1000/079/Purple/v4/e9/ab/55/e9ab55ab-6b7c-04ab-034e-833c113be412/mzl.ganeacuj.1024x1024-65.jpg", "http://a247.phobos.apple.com/us/r1000/107/Purple/v4/f3/87/60/f3876038-162a-7df4-87e5-54b6a5b14b78/mzl.vxycagic.1024x1024-65.jpg", "http://a831.phobos.apple.com/us/r1000/093/Purple2/v4/8b/b3/77/8bb37753-e3d5-9f45-ecfb-bf09cdb660f0/mzl.ncygstwb.1024x1024-65.jpg", "http://a376.phobos.apple.com/us/r1000/078/Purple/v4/f3/4e/36/f34e362f-dee0-0903-436e-034ba94a6f79/mzl.ecchwkyv.1024x1024-65.jpg", "http://a1624.phobos.apple.com/us/r1000/079/Purple/v4/db/12/9d/db129d6b-107b-fa80-f472-a8c7809ef513/mzl.xjmeijfn.1024x1024-65.jpg"], "artworkUrl512":"http://a1435.phobos.apple.com/us/r1000/076/Purple/v4/d1/36/f5/d136f5d0-3962-9ba1-95b2-3ca0ba3be9ec/mzl.zzqaoikx.jpg", "artistId":595176744, "artistName":"Hongkun Song", "price":1.99, "version":"2.0", 
        每日一道理
    只有启程,才会到达理想和目的地,只有拼搏,才会得获辉煌的成功,只有播种,才会有收获。只有追求,才会品味堂堂正正的人。

        

    "description":"Measure actual angles from a distance? This magical App makes impossible happen!\n\nJust throw your plastic protractor away if you have an iPhone! I think you would never have to use traditional protractors any more! Since here is a much better tool for you to measure angles, that is your iOS device and of course, with the amazing app 3D Protractor!\n\n3D Protractor! A super tool for you to measure all kinds of angles in the 3D space by moving and rotating your iOS device or using the camera!\n\nDon\u2019t limit your imagination of measuring angles to just measuring the angle between two lines on a plane! This was an old thinking. 3D Protractor breaks it! In fact,it is so powerful that it can do following five jobs:\n1,Line-Line Angle Measurement. It can measure the angle of any two lines in the space,include the angle on a plane.\n2,Slope Angle Measurement. \n3,Dihedral Angle Measurement.\n4,Line-Face Angle Measurement.\n\n5,Camera Angle Measurement. It is a super cool feature! It can measure actual angles of any objects in front by the device's camera. Unbelievable! Actual angle! \n\nYou might feel a little bit confused at first after reading the above professional descriptions. This App uses 3D models to make it really easy for you to understand and use.\nEveryone can use it. Students can use it to do their homework. Teachers can use it to teach geometry especially solid geometry, which makes a really good teaching tool. Engineers can use it to measure any angles they need to know at work. And of course, there are many many more usages in our daily life.\n\n3D Protractor! Re-invention of protractor! \nA great app to make measuring angle easy and more accurate! \nA great app to change the world of angle measurement!\n\nPS. 1、If you measure an angle in a long time,the precision may be lower.\n2、This version has no Ads!", "currency":"USD", "genres":["Utilities", "Education"], "genreIds":["6002", "6017"], "releaseDate":"2013-01-26T07:54:39Z", "sellerName":"Hongkun Song", "bundleId":"com.manmanlai.-D-Protractor", "trackId":595176741, "trackName":"3D Protractor", "primaryGenreName":"Utilities", "primaryGenreId":6002, 

        

    "releaseNotes":"1、Add Camera Angle Measurement Feature; \nIt is a super cool feature! It can measure actual angles of any objects in front by the device's camera. Unbelievable! Actual angle!\n2、Add radian number display; \nTap the number, then you would see the transition between degree and radian number. \n3、Add traditional chinese version; \n4、Fix some bugs;", "formattedPrice":"$1.99", "wrapperType":"software", "trackCensoredName":"3D Protractor", "trackViewUrl":"https://itunes.apple.com/us/app/3d-protractor/id595176741?mt=8&uo=4", "contentAdvisoryRating":"4+", "artworkUrl100":"http://a1435.phobos.apple.com/us/r1000/076/Purple/v4/d1/36/f5/d136f5d0-3962-9ba1-95b2-3ca0ba3be9ec/mzl.zzqaoikx.jpg", "languageCodesISO2A":["ZH", "EN"], "fileSizeBytes":"14633609", "averageUserRatingForCurrentVersion":5.0, "userRatingCountForCurrentVersion":2, "trackContentRating":"4+", "averageUserRating":4.5, "userRatingCount":8}]

        

    }

        

     

        

    可以看出,包含更新的内容都有,这就非常好办了。详细的实现式方这里写一下取获的方法:

        

     

        

    [cpp]  

        

      

        

    [plain]  

        

    <span style="font-size:24px;">NSString *query = [NSString stringWithFormat:@"https://itunes.apple.com/lookup?id=%@", AppID];  

        

        query = [query stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];  

        

        NSData *jsonData = [[NSString stringWithContentsOfURL:[NSURL URLWithString:query] encoding:NSUTF8StringEncoding error:nil] dataUsingEncoding:NSUTF8StringEncoding];  

        

        NSError *error = nil;  

        

        NSDictionary *results = jsonData ? [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error] : nil;</span>  

        

    取获了NSDictionary 的results,以后一切都好办。代码中地特入加UTF8String编码,用不也可以。当然,网页上说All JSON results are encoded as UTF-8。

        

     

        

    另外,要得获App的本版号,如下

        

    App本版: [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];

        

    App Build本版: [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"];

    文章结束给大家分享下程序员的一些笑话语录: 据说有一位软件工程师,一位硬件工程师和一位项目经理同坐车参加研讨会。不幸在从盘山公路下山时坏在半路上了。于是两位工程师和一位经理就如何修车的问题展开了讨论。
    硬件工程师说:“我可以用随身携带的瑞士军刀把车坏的部分拆下来,找出原因,排除故障。”
    项目经理说:“根据经营管理学,应该召开会议,根据问题现状写出需求报告,制订计划,编写日程安排,逐步逼近,alpha测试,beta1测试和beta2测试解决问题。”
    软件工程说:“咱们还是应该把车推回山顶再开下来,看看问题是否重复发生。”

  • 相关阅读:
    牛客 小a与星际探索 bfs
    gear gym 思维题
    dp Surf
    P1280 尼克的任务
    Codeforces Round #539 (Div. 2) C. Sasha and a Bit of Relax
    Codeforces Round #542 C. Connect 搜索
    Layui 文件上传 附带data数据
    Layui 隐藏左侧菜单
    Layui 关闭当前标签页
    Layui Iframe页面间 方法的相互调用
  • 原文地址:https://www.cnblogs.com/xinyuyuanm/p/3063487.html
Copyright © 2011-2022 走看看