简体   繁体   English

PhoneGap 1.0应用程序提交到AppStore失败

[英]PhoneGap 1.0 app Submit to AppStore fails

We have an old app created with PhoneGap version 1.0. 我们有一个使用PhoneGap 1.0版创建的旧应用。 There is absolutely no chance to migrate to latest PhoneGap/Cordova because of huge changes in both iOS/JS code required. 由于所需的两个iOS / JS代码都发生巨大变化 ,因此绝对没有机会迁移到最新的PhoneGap / Cordova。

An attempt to upload an app compiled with iOS SDK 6.1 failed with message: "Apps are not permitted to access the UDID and must not use the uniqueIdentifier method of UIDevice. Please update your apps and servers to associate users with the Vendor or Advertising identifiers introduced in iOS 6.". 尝试上传使用iOS SDK 6.1编译的应用程序失败,并显示以下消息:“应用程序不允许访问UDID,并且不得使用UIDevice的uniqueIdentifier方法。请更新您的应用程序和服务器,以将用户与引入的供应商或广告标识符相关联在iOS 6中。”。

PhoneGap 1.0 sources are not available in public, it's distributed as compiled framework. PhoneGap 1.0来源不公开,它作为已编译框架分发。

Does anyone have an idea how to workaround this issue? 有谁知道如何解决此问题?

Crazy, but WORKING solution (hack) 疯狂,但工作解决方案 (hack)

Well, once PhoneGap 1.0 is provided as compiled lib, we can try to change the compiled binary itself. 好了,一旦PhoneGap 1.0作为已编译的库提供,我们可以尝试更改已编译的二进制文件本身。

The reason of Apple reject are calls to [UIDevice uniqueIdentifier] method deprecated in iOS 6. If your app (JS code) does not use UDID provided by PhoneGap (actually, have no idea is there a way to get it), it's safe (!? see NOTE bellow) to change the call of uniqueIdentifier to any other method returning NSString of UIDevice class. Apple拒绝的原因是对iOS 6中不推荐使用的[UIDevice uniqueIdentifier]方法的调用。如果您的应用(JS代码)未使用PhoneGap提供的UDID(实际上,不知道有没有办法来获得它),这是安全的( !?参见下面的“注意”,以将uniqueIdentifier的调用更改为其他任何返回UIDevice类的NSString的方法。

I've used +(NSString *)systemVersion - getter of systemVersion property. 我已经使用+(NSString *)systemVersion-systemVersion属性的获取器。

So, get any HEX editor and open file: /users/Shared/PhoneGap/Frameworks/PhoneGap.framework/PhoneGap replace uniqueIdentifier with systemVersion\\0\\0\\0 . 因此,得到任何HEX编辑和打开文件:/users/Shared/PhoneGap/Frameworks/PhoneGap.framework/PhoneGap与systemVersion \\ 0 \\ 0 \\ 0替换唯一标识符

\\0 - are zero code bytes, needed to align the length of new name which is 3 bytes shorter! \\ 0-为零代码字节,需要对齐新名称的长度,该名称要短3个字节!

Rebuild your app, and… viola upload to AppStore succeeded! 重建您的应用程序,并且…将中提琴成功上传到AppStore!

NOTE: Sure, you MUST check your app functionality not broken. 注意:当然,您必须检查您的应用程序功能是否未损坏。 I did for mine app and it works like a charm. 我为我的应用程序做了,它就像一个魅力。

Nope. 不。 Apple is your issue here. 苹果是您的问题。 You have to update your PhoneGap to at least 2.5, see posting here: https://shazronatadobe.wordpress.com/2013/05/01/cordovaphonegap-and-the-new-apple-app-store-requirements/ 您必须将PhoneGap更新到至少2.5,请参见此处发布: https : //shazronatadobe.wordpress.com/2013/05/01/cordovaphonegap-and-the-new-apple-app-store-requirements/

And you have to update any plugin or native you wrote to not use uuid. 而且,您必须更新编写的任何插件或本机才能不使用uuid。

I had the same issue using phonegap 1.2.0 but the above "hack" didnt work for me - it gave me an error 我在使用phonegap 1.2.0时遇到了同样的问题,但是上面的“ hack”对我不起作用-它给了我一个错误

ld: file is universal (3 slices) but does not contain a(n) armv7 slice:

So instead I found a much easier solution - locate the PhoneGapLib.xcodeproj that gets installed when you install phonegap and open it, then search for the "uniqueIdentifier" call. 因此,我找到了一个更简单的解决方案-找到在安装phonegap并打开它时安装的PhoneGapLib.xcodeproj,然后搜索“ uniqueIdentifier”调用。

Then I used the below code taken from here ( https://stackoverflow.com/a/9458313/1851746 ) in order to substitute the UUID value - 然后,我使用了以下代码( https://stackoverflow.com/a/9458313/1851746 ),以替换UUID值-

- (NSString *)getUUID
{
    NSString *UUID = [[NSUserDefaults standardUserDefaults] objectForKey:@"uniqueID"];
    if (!UUID)
    {
        CFUUIDRef theUUID = CFUUIDCreate(NULL);
        CFStringRef string = CFUUIDCreateString(NULL, theUUID);
        CFRelease(theUUID);
        UUID = [(__bridge NSString*)string stringByReplacingOccurrencesOfString:@"-"withString:@""];
        [[NSUserDefaults standardUserDefaults] setValue:UUID forKey:@"uniqueID"];
    }
    return UUID;
}

Calling this method with [self getUUID] instead of uniqueIdentifier works though for some reason it led to an error with a subsequent value added to the dictionary for the phonegap version. 使用[self getUUID]而不是uniqueIdentifier调用此方法是可行的,尽管由于某种原因,它会导致错误,并将后续值添加到phonegap版本的字典中。 So I just hard coded this instead in the same block as the above. 因此,我只是在与上述相同的代码块中对此进行了硬编码。

Then change target to "PhoneGap", build, then go to the Products folder and open location in finder, copy the framework folder, and replace the one found in Users/Shared/PhoneGap/Frameworks. 然后将目标更改为“ PhoneGap”,进行构建,然后转到Products文件夹并在finder中打开位置,复制framework文件夹,并替换在Users / Shared / PhoneGap / Frameworks中找到的文件夹。

Project should compile and be accepted to the App Store 项目应编译并被App Store接受

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM