获取错误JSON.stringify()ing参数:TypeError:JSON.stringify无法在IOS模拟器中序列化循环结构

时间:2013-11-09 04:02:01

标签: ios cordova dojo xcode5 ibm-mobilefirst

我正在为我的客户开发一个演示应用程序。此演示应用程序的目的是显示Worklight Hybrid应用程序可以在所有环境中运行。我的演示应用程序在Android模拟器中工作正常,但当我将Iphone环境文件夹中的Package文件夹中的zip文件传输到具有XCODE 5.0的MAC系统并尝试运行该应用程序时,我收到此错误 -

"error JSON.stringify()ing argument: TypeError: JSON.stringify cannot serialize cyclic structures"

我正在使用Worklight V6和其中提供的默认dojo版本。我在网上搜索,发现很少有人也在努力解决这个问题。这里报告了一个例子 -

http://dojo-toolkit.33424.n3.nabble.com/ERROR-error-JSON-stringify-ing-argument-TypeError-JSON-stringify-cannot-serialize-cyclic-structures-td3996156.html

有人可以告诉我这个错误的根本原因是什么?似乎问题是模拟器或工作灯中使用的cordova插件版本。有没有解决方法呢?

这是我的XCode日志 -

   2013-11-17 22:08:02.290 KaiserTestApp[6396:a0b] ***TeaLeaf Library Version***:      8.8.1.56 
   2013-11-17 22:08:03.002 KaiserTestApp[6396:a0b] Application windows are expected to  have a root view controller at the end of application launch 
   2013-11-17 22:08:04.129 KaiserTestApp[6396:3e07] Web resources integrity test is disabled. 
   2013-11-17 22:08:04.134 KaiserTestApp[6396:a0b] Multi-tasking -> Device: YES, App: YES 
   2013-11-17 22:08:05.003 KaiserTestApp[6396:a0b] Resetting plugins due to page load. 
   2013-11-17 22:08:05.509 KaiserTestApp[6396:a0b] Finished load of: file:///Users/prasuna/Library/Application Support/iPhone Simulator/7.0.3/Applications/5BFF2FA8-9E4B-45D3-B991-43EE8008A5F4/Library/Application Support/www956725435/default/KaiserTestApp.html 
   2013-11-17 22:08:05.524 KaiserTestApp[6396:a0b] DEPRECATION NOTICE: The Connection ReachableViaWWAN return value of '2g' is deprecated as of Cordova version 2.6.0 and will be changed to 'cellular' in a future release.  
   2013-11-17 22:08:05.532 KaiserTestApp[6396:a0b] {     appVersionPref = "1.0";     freeSpace = 132894613504;     wlSkinLoaderChecksum = "(null)";     wlSkinName = default; } 
   2013-11-17 22:08:05.541 KaiserTestApp[6396:a0b] [DEBUG] wlclient init started 
   2013-11-17 22:08:05.542 KaiserTestApp[6396:a0b] [DEBUG] Read cookies: null 
   2013-11-17 22:08:05.542 KaiserTestApp[6396:a0b] [DEBUG] CookieMgr read cookies: {} 
   2013-11-17 22:08:05.547 KaiserTestApp[6396:a0b] [DEBUG] before: app init onSuccess 
   2013-11-17 22:08:05.548 KaiserTestApp[6396:a0b] [DEBUG] after: app init onSuccess 
   2013-11-17 22:08:05.548 KaiserTestApp[6396:a0b] [DEBUG] added onPause event handler  
   2013-11-17 22:08:05.549 KaiserTestApp[6396:a0b] [DEBUG] wlclient init success 
   2013-11-17 22:08:05.638 KaiserTestApp[6396:a0b] [LOG] I am in main js file 
   2013-11-17 22:08:05.638 KaiserTestApp[6396:a0b] [DEBUG] HomeController created 
   2013-11-17 22:08:05.639 KaiserTestApp[6396:a0b] [DEBUG] Testing log 
   2013-11-17 22:09:21.000 KaiserTestApp[6396:a0b] [ERROR] error JSON.stringify()ing argument: TypeError: JSON.stringify cannot serialize cyclic structures. 
   2013-11-17 22:09:21.000 KaiserTestApp[6396:a0b] [ERROR] error JSON.stringify()ing argument: TypeError: JSON.stringify cannot serialize cyclic structures.  

我也尝试在IOS 6中运行演示应用程序,但在编译时我遇到了以下错误。有人可以帮我理解这意味着什么,我该如何解决?

setenv WRAPPER_EXTENSION app

setenv WRAPPER_NAME KaiserTestApp.app

setenv WRAPPER_SUFFIX .app

setenv XCODE_APP_SUPPORT_DIR /Applications/Xcode.app/Contents/Developer/Library/Xcode

setenv XCODE_PRODUCT_BUILD_VERSION 4H1503

setenv XCODE_VERSION_ACTUAL 0463

setenv XCODE_VERSION_MAJOR 0400

setenv XCODE_VERSION_MINOR 0460

setenv YACC yacc

/bin/sh -c /Users/wppa/Library/Developer/Xcode/DerivedData/KaiserTestProjKaiserTestAppIphone-egvnwnfozzvukmdsxsnkzlsfjwgz/Build/Intermediates/KaiserTestProjKaiserTestAppIphone.build/Debug-iphonesimulator/KaiserTestProjKaiserTestAppIphone.build/Script-427B829D1393724500F223DC.sh


   Running a custom build phase script: buildtime.sh

   /Users/wppa/Library/Developer/Xcode/DerivedData/KaiserTestProjKaiserTestAppIphone-      egvnwnfozzvukmdsxsnkzlsfjwgz/Build/Intermediates/KaiserTestProjKaiserTestAppIphone.build/Debug-iphonesimulator/KaiserTestProjKaiserTestAppIphone.build/Script-427B829D1393724500F223DC.sh: line 7: /Users/wppa/Kaiser/buildtime.sh: Permission denied

   DONE with script: buildtime.sh (exitStatus=126)\n\n

1 个答案:

答案 0 :(得分:0)

关于您在iOS 6中遇到的具体问题,它实际上与iOS 6无关,也与此问题无关(“......无法序列化循环结构......”)。 我建议将其拆分为另一个问题,或者只删除它。

  

运行自定义构建阶段脚本:buildtime.sh

     

/用户/ wppa /库/开发商/ Xcode中/ DerivedData / KaiserTestProjKaiserTestAppIphone-   egvnwnfozzvukmdsxsnkzlsfjwgz /编译/中间体/ KaiserTestProjKaiserTestAppIphone.build /调试-iphonesimulator / KaiserTestProjKaiserTestAppIphone.build / Script-427B829D1393724500F223DC.sh:   第7行:/Users/wppa/Kaiser/buildtime.sh:权限被拒绝

您缺少文件buildtime.sh的执行权限。

在我对这个问题的回答中详细解释了问题和解决方案:IBM Worklight - "Permission denied" when building in Xcode

我建议按照以下步骤操作:

使用CHMOD更改权限:

  1. 将路径复制到包含buildtime.sh文件的文件夹
  2. 打开终端应用
  3. 运行以下命令(但使用上面1中的路径):chmod 755 /Users/idan/Documents/Worklight/workspace-6001/TestProject/apps/TestApp/iphone/native/buildtime.sh